| Index: tools/dom/src/chrome/alarms.dart
|
| diff --git a/tools/dom/src/chrome/alarms.dart b/tools/dom/src/chrome/alarms.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3dac35f30abb183fe319fc1f33588f5f1dec3e88
|
| --- /dev/null
|
| +++ b/tools/dom/src/chrome/alarms.dart
|
| @@ -0,0 +1,212 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Generated from namespace: alarms
|
| +
|
| +part of chrome;
|
| +
|
| +/**
|
| + * Types
|
| + */
|
| +
|
| +class AlarmsAlarm extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + AlarmsAlarm({String name, double scheduledTime, double periodInMinutes}) {
|
| + if (?name)
|
| + this.name = name;
|
| + if (?scheduledTime)
|
| + this.scheduledTime = scheduledTime;
|
| + if (?periodInMinutes)
|
| + this.periodInMinutes = periodInMinutes;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + AlarmsAlarm._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + /// Name of this alarm.
|
| + String get name => JS('String', '#.name', this._jsObject);
|
| +
|
| + void set name(String name) {
|
| + JS('void', '#.name = #', this._jsObject, name);
|
| + }
|
| +
|
| + /// Time at which this alarm was scheduled to fire, in milliseconds past the
|
| + /// epoch (e.g. <code>Date.now() + n</code>). For performance reasons, the
|
| + /// alarm may have been delayed an arbitrary amount beyond this.
|
| + double get scheduledTime => JS('double', '#.scheduledTime', this._jsObject);
|
| +
|
| + void set scheduledTime(double scheduledTime) {
|
| + JS('void', '#.scheduledTime = #', this._jsObject, scheduledTime);
|
| + }
|
| +
|
| + /// If not null, the alarm is a repeating alarm and will fire again in
|
| + /// <var>periodInMinutes</var> minutes.
|
| + double get periodInMinutes => JS('double', '#.periodInMinutes', this._jsObject);
|
| +
|
| + void set periodInMinutes(double periodInMinutes) {
|
| + JS('void', '#.periodInMinutes = #', this._jsObject, periodInMinutes);
|
| + }
|
| +
|
| +}
|
| +
|
| +class AlarmsAlarmCreateInfo extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + AlarmsAlarmCreateInfo({double when, double delayInMinutes, double periodInMinutes}) {
|
| + if (?when)
|
| + this.when = when;
|
| + if (?delayInMinutes)
|
| + this.delayInMinutes = delayInMinutes;
|
| + if (?periodInMinutes)
|
| + this.periodInMinutes = periodInMinutes;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + AlarmsAlarmCreateInfo._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + /// Time at which the alarm should fire, in milliseconds past the epoch (e.g.
|
| + /// <code>Date.now() + n</code>).
|
| + double get when => JS('double', '#.when', this._jsObject);
|
| +
|
| + void set when(double when) {
|
| + JS('void', '#.when = #', this._jsObject, when);
|
| + }
|
| +
|
| + /// Length of time in minutes after which the <code>onAlarm</code> event should
|
| + /// fire.<br/><br/> <!-- TODO: need minimum=0 -->
|
| + double get delayInMinutes => JS('double', '#.delayInMinutes', this._jsObject);
|
| +
|
| + void set delayInMinutes(double delayInMinutes) {
|
| + JS('void', '#.delayInMinutes = #', this._jsObject, delayInMinutes);
|
| + }
|
| +
|
| + /// If set, the onAlarm event should fire every <var>periodInMinutes</var>
|
| + /// minutes after the initial event specified by <var>when</var> or
|
| + /// <var>delayInMinutes</var>. If not set, the alarm will only fire
|
| + /// once.<br/><br/> <!-- TODO: need minimum=0 -->
|
| + double get periodInMinutes => JS('double', '#.periodInMinutes', this._jsObject);
|
| +
|
| + void set periodInMinutes(double periodInMinutes) {
|
| + JS('void', '#.periodInMinutes = #', this._jsObject, periodInMinutes);
|
| + }
|
| +
|
| +}
|
| +
|
| +/**
|
| + * Events
|
| + */
|
| +
|
| +/// Fired when an alarm has elapsed. Useful for event pages.
|
| +class Event_alarms_onAlarm extends Event {
|
| + void addListener(void callback(AlarmsAlarm alarm)) {
|
| + void __proxy_callback(alarm) {
|
| + if (?callback) {
|
| + callback(new AlarmsAlarm._proxy(alarm));
|
| + }
|
| + }
|
| + super.addListener(callback);
|
| + }
|
| +
|
| + void removeListener(void callback(AlarmsAlarm alarm)) {
|
| + void __proxy_callback(alarm) {
|
| + if (?callback) {
|
| + callback(new AlarmsAlarm._proxy(alarm));
|
| + }
|
| + }
|
| + super.removeListener(callback);
|
| + }
|
| +
|
| + bool hasListener(void callback(AlarmsAlarm alarm)) {
|
| + void __proxy_callback(alarm) {
|
| + if (?callback) {
|
| + callback(new AlarmsAlarm._proxy(alarm));
|
| + }
|
| + }
|
| + super.hasListener(callback);
|
| + }
|
| +
|
| + Event_alarms_onAlarm(jsObject) : super._(jsObject, 1);
|
| +}
|
| +
|
| +/**
|
| + * Functions
|
| + */
|
| +
|
| +class API_alarms {
|
| + /*
|
| + * API connection
|
| + */
|
| + Object _jsObject;
|
| +
|
| + /*
|
| + * Events
|
| + */
|
| + Event_alarms_onAlarm onAlarm;
|
| +
|
| + /*
|
| + * Functions
|
| + */
|
| + /// Creates an alarm. Near the time(s) specified by <var>alarmInfo</var>, the
|
| + /// <code>onAlarm</code> event is fired. If there is another alarm with the
|
| + /// same name (or no name if none is specified), it will be cancelled and
|
| + /// replaced by this alarm.<br/><br/> In order to reduce the load on the user's
|
| + /// machine, Chrome limits alarms to at most once every 1 minute but may delay
|
| + /// them an arbitrary amount more. That is, setting
|
| + /// <code>$ref:[alarms.AlarmCreateInfo.delayInMinutes delayInMinutes]</code> or
|
| + /// <code>$ref:[alarms.AlarmCreateInfo.periodInMinutes periodInMinutes]</code>
|
| + /// to less than <code>1</code> will not be honored and will cause a warning.
|
| + /// <code>$ref:[alarms.AlarmCreateInfo.when when]</code> can be set to less
|
| + /// than 1 minute after "now" without warning but won't actually cause the
|
| + /// alarm to fire for at least 1 minute.<br/><br/> To help you debug your app
|
| + /// or extension, when you've loaded it unpacked, there's no limit to how often
|
| + /// the alarm can fire.
|
| + void create(AlarmsAlarmCreateInfo alarmInfo, [String name]) => JS('void', '#.create(#, #)', this._jsObject, name, convertArgument(alarmInfo));
|
| +
|
| + /// Retrieves details about the specified alarm.
|
| + void get(void callback(AlarmsAlarm alarm), [String name]) {
|
| + void __proxy_callback(alarm) {
|
| + if (?callback) {
|
| + callback(new AlarmsAlarm._proxy(alarm));
|
| + }
|
| + }
|
| + JS('void', '#.get(#, #)', this._jsObject, name, convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
| +
|
| + /// Gets an array of all the alarms.
|
| + void getAll(void callback(List<AlarmsAlarm> alarms)) {
|
| + void __proxy_callback(alarms) {
|
| + if (?callback) {
|
| + List<AlarmsAlarm> __proxy_alarms = new List<AlarmsAlarm>();
|
| + for (var o in alarms) {
|
| + __proxy_alarms.add(new AlarmsAlarm._proxy(o));
|
| + }
|
| + callback(__proxy_alarms);
|
| + }
|
| + }
|
| + JS('void', '#.getAll(#)', this._jsObject, convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
| +
|
| + /// Clears the alarm with the given name.
|
| + void clear([String name]) => JS('void', '#.clear(#)', this._jsObject, name);
|
| +
|
| + /// Clears all alarms.
|
| + void clearAll() => JS('void', '#.clearAll()', this._jsObject);
|
| +
|
| + API_alarms(this._jsObject) {
|
| + onAlarm = new Event_alarms_onAlarm(JS('', '#.onAlarm', this._jsObject));
|
| + }
|
| +}
|
|
|