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 // TODO(mpcomplete): We need documentation before we can release this. | 5 // TODO(mpcomplete): We need documentation before we can release this. |
6 | 6 |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 callback AlarmCallback = void (Alarm alarm); | 43 callback AlarmCallback = void (Alarm alarm); |
44 callback AlarmListCallback = void (Alarm[] alarms); | 44 callback AlarmListCallback = void (Alarm[] alarms); |
45 | 45 |
46 interface Functions { | 46 interface Functions { |
47 // Creates an alarm. Near the time(s) specified by <var>alarmInfo</var>, | 47 // Creates an alarm. Near the time(s) specified by <var>alarmInfo</var>, |
48 // the <code>onAlarm</code> event is fired. If there is another alarm with | 48 // the <code>onAlarm</code> event is fired. If there is another alarm with |
49 // the same name (or no name if none is specified), it will be cancelled and | 49 // the same name (or no name if none is specified), it will be cancelled and |
50 // replaced by this alarm. | 50 // replaced by this alarm. |
51 // | 51 // |
52 // Note that granularity is not guaranteed: times are more of a hint to the | 52 // In order to reduce the load on the user's machine, Chrome limits alarms |
53 // browser. For performance reasons, alarms may be delayed an arbitrary | 53 // to at most once every 5 minutes but may delay them an arbitrary amount |
54 // amount of time before firing. | 54 // more. That is, setting <code>$ref:[alarms.AlarmCreateInfo.delayInMinutes |
55 // delayInMinutes]</code> or | |
56 // <code>$ref:[alarms.AlarmCreateInfo.periodInMinutes | |
57 // periodInMinutes]</code> to less than <code>5</code> will not be honored | |
58 // and cause a warning. <code>$ref:[alarms.AlarmCreateInfo.when | |
Yoyo Zhou
2013/01/09 00:38:00
will cause
Jeffrey Yasskin
2013/01/09 01:04:45
Done.
| |
59 // when]</code> can be set to less than 5 minutes after "now" without | |
60 // warning but won't actually cause the alarm to run for at least 5 minutes. | |
Yoyo Zhou
2013/01/09 00:38:00
s/run/fire/
Jeffrey Yasskin
2013/01/09 01:04:45
Done.
| |
61 // | |
62 // To help you debug your app or extension, when you've loaded it unpacked, | |
63 // there's no limit to how often the alarm can fire. | |
55 // | 64 // |
56 // |name|: Optional name to identify this alarm. Defaults to the empty | 65 // |name|: Optional name to identify this alarm. Defaults to the empty |
57 // string. | 66 // string. |
58 // | 67 // |
59 // |alarmInfo|: Describes when the alarm should fire. The initial time must | 68 // |alarmInfo|: Describes when the alarm should fire. The initial time must |
60 // be specified by either <var>when</var> or <var>delayInMinutes</var> (but | 69 // be specified by either <var>when</var> or <var>delayInMinutes</var> (but |
61 // not both). If <var>periodInMinutes</var> is set, the alarm will repeat | 70 // not both). If <var>periodInMinutes</var> is set, the alarm will repeat |
62 // every <var>periodInMinutes</var> minutes after the initial event. If | 71 // every <var>periodInMinutes</var> minutes after the initial event. If |
63 // neither <var>when</var> or <var>delayInMinutes</var> is set for a | 72 // neither <var>when</var> or <var>delayInMinutes</var> is set for a |
64 // repeating alarm, <var>periodInMinutes</var> is used as the default for | 73 // repeating alarm, <var>periodInMinutes</var> is used as the default for |
(...skipping 14 matching lines...) Expand all Loading... | |
79 // Clears all alarms. | 88 // Clears all alarms. |
80 static void clearAll(); | 89 static void clearAll(); |
81 }; | 90 }; |
82 | 91 |
83 interface Events { | 92 interface Events { |
84 // Fired when an alarm has elapsed. Useful for event pages. | 93 // Fired when an alarm has elapsed. Useful for event pages. |
85 // |alarm|: The alarm that has elapsed. | 94 // |alarm|: The alarm that has elapsed. |
86 static void onAlarm(Alarm alarm); | 95 static void onAlarm(Alarm alarm); |
87 }; | 96 }; |
88 }; | 97 }; |
OLD | NEW |