OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Use the <code>chrome.alarms</code> API to schedule code to run | 5 // Use the <code>chrome.alarms</code> API to schedule code to run |
6 // periodically or at a specified time in the future. | 6 // periodically or at a specified time in the future. |
7 namespace alarms { | 7 namespace alarms { |
8 dictionary Alarm { | 8 dictionary Alarm { |
9 // Name of this alarm. | 9 // Name of this alarm. |
10 DOMString name; | 10 DOMString name; |
(...skipping 22 matching lines...) Expand all Loading... |
33 double? delayInMinutes; | 33 double? delayInMinutes; |
34 | 34 |
35 // If set, the onAlarm event should fire every <var>periodInMinutes</var> | 35 // If set, the onAlarm event should fire every <var>periodInMinutes</var> |
36 // minutes after the initial event specified by <var>when</var> or | 36 // minutes after the initial event specified by <var>when</var> or |
37 // <var>delayInMinutes</var>. If not set, the alarm will only fire once. | 37 // <var>delayInMinutes</var>. If not set, the alarm will only fire once. |
38 // | 38 // |
39 // <!-- TODO: need minimum=0 --> | 39 // <!-- TODO: need minimum=0 --> |
40 double? periodInMinutes; | 40 double? periodInMinutes; |
41 }; | 41 }; |
42 | 42 |
43 callback AlarmCallback = void (Alarm alarm); | 43 callback AlarmCallback = void (optional Alarm alarm); |
44 callback AlarmListCallback = void (Alarm[] alarms); | 44 callback AlarmListCallback = void (Alarm[] alarms); |
45 callback ClearCallback = void (boolean wasCleared); | 45 callback ClearCallback = void (boolean wasCleared); |
46 | 46 |
47 interface Functions { | 47 interface Functions { |
48 // Creates an alarm. Near the time(s) specified by <var>alarmInfo</var>, | 48 // Creates an alarm. Near the time(s) specified by <var>alarmInfo</var>, |
49 // the <code>onAlarm</code> event is fired. If there is another alarm with | 49 // the <code>onAlarm</code> event is fired. If there is another alarm with |
50 // the same name (or no name if none is specified), it will be cancelled and | 50 // the same name (or no name if none is specified), it will be cancelled and |
51 // replaced by this alarm. | 51 // replaced by this alarm. |
52 // | 52 // |
53 // In order to reduce the load on the user's machine, Chrome limits alarms | 53 // In order to reduce the load on the user's machine, Chrome limits alarms |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Clears all alarms. | 87 // Clears all alarms. |
88 static void clearAll(optional ClearCallback callback); | 88 static void clearAll(optional ClearCallback callback); |
89 }; | 89 }; |
90 | 90 |
91 interface Events { | 91 interface Events { |
92 // Fired when an alarm has elapsed. Useful for event pages. | 92 // Fired when an alarm has elapsed. Useful for event pages. |
93 // |alarm|: The alarm that has elapsed. | 93 // |alarm|: The alarm that has elapsed. |
94 static void onAlarm(Alarm alarm); | 94 static void onAlarm(Alarm alarm); |
95 }; | 95 }; |
96 }; | 96 }; |
OLD | NEW |