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 // File-level comment to appease parser. Eventually this will not be necessary. | 5 // File-level comment to appease parser. Eventually this will not be necessary. |
6 // TODO(mpcomplete): We need documentation before we can release this. | 6 // TODO(mpcomplete): We need documentation before we can release this. |
7 | 7 |
8 namespace alarms { | 8 namespace alarms { |
9 dictionary Alarm { | 9 dictionary Alarm { |
10 // Name of this alarm. | 10 // Name of this alarm. |
11 DOMString name; | 11 DOMString name; |
12 | 12 |
13 // Original length of time in minutes after which the onAlarm event should | 13 // Time at which this alarm was scheduled to fire, in milliseconds past the |
14 // fire. | 14 // epoch (e.g. Date.now() + n). For performance reasons, the alarm may have |
15 // TODO: need minimum=0 | 15 // been delayed an arbitrary amount beyond this. |
16 double delayInMinutes; | 16 double scheduledTime; |
17 | 17 |
18 // True if the alarm repeatedly fires at regular intervals, false if it | 18 // If not null, the alarm was re-scheduled 'repeatAfterMinutes' minutes |
19 // only fires once. | 19 // after it fired. |
20 boolean repeating; | 20 double? repeatAfterMinutes; |
Aaron Boodman
2012/06/09 04:21:10
What is the purpose of this property?
Jeffrey Yasskin
2012/06/11 19:28:36
Checking whether it's set at all replaces the 'rep
| |
21 }; | 21 }; |
22 | 22 |
23 // TODO(mpcomplete): rename to CreateInfo when http://crbug.com/123073 is | 23 // TODO(mpcomplete): rename to CreateInfo when http://crbug.com/123073 is |
24 // fixed. | 24 // fixed. |
25 dictionary AlarmCreateInfo { | 25 dictionary AlarmCreateInfo { |
26 // Time at which the alarm should fire, in milliseconds past the epoch | |
27 // (e.g. Date.now() + n). Note that granularity is not guaranteed: this | |
28 // value is more of a hint to the browser. For performance reasons, alarms | |
29 // may be delayed an arbitrary amount of time before firing. | |
30 // | |
31 // This option may not be set if delayInMinutes is set or | |
Aaron Boodman
2012/06/09 04:21:10
How about just creating two methods: createOneShot
Jeffrey Yasskin
2012/06/11 19:28:36
Sure. How's this look?
| |
32 // repeating is true. | |
33 double? approxTimeToFire; | |
Aaron Boodman
2012/06/09 04:21:10
I don't think the 'approx' qualifier is needed. Th
Jeffrey Yasskin
2012/06/11 19:28:36
Done.
| |
34 | |
26 // Length of time in minutes after which the onAlarm event should fire. | 35 // Length of time in minutes after which the onAlarm event should fire. |
27 // Note that granularity is not guaranteed: this value is more of a hint to | 36 // Note that granularity is not guaranteed: this value is more of a hint to |
28 // the browser. For performance reasons, alarms may be delayed an arbitrary | 37 // the browser. For performance reasons, alarms may be delayed an arbitrary |
29 // amount of time before firing. | 38 // amount of time before firing. |
39 // | |
40 // This option may not be set if approxTimeToFire is set. | |
41 // | |
30 // TODO: need minimum=0 | 42 // TODO: need minimum=0 |
31 double delayInMinutes; | 43 double? delayInMinutes; |
32 | 44 |
33 // True if the alarm should repeatedly fire at regular intervals. Defaults | 45 // True if the alarm should repeatedly fire at regular intervals. Defaults |
34 // to false. | 46 // to false. |
35 boolean? repeating; | 47 boolean? repeating; |
36 }; | 48 }; |
37 | 49 |
38 callback AlarmCallback = void (Alarm alarm); | 50 callback AlarmCallback = void (Alarm alarm); |
39 callback AlarmListCallback = void (Alarm[] alarms); | 51 callback AlarmListCallback = void (Alarm[] alarms); |
40 | 52 |
41 interface Functions { | 53 interface Functions { |
(...skipping 18 matching lines...) Expand all Loading... | |
60 // Clears all alarms. | 72 // Clears all alarms. |
61 static void clearAll(); | 73 static void clearAll(); |
62 }; | 74 }; |
63 | 75 |
64 interface Events { | 76 interface Events { |
65 // Fired when an alarm has elapsed. Useful for transient background pages. | 77 // Fired when an alarm has elapsed. Useful for transient background pages. |
66 // |alarm|: The alarm that has elapsed. | 78 // |alarm|: The alarm that has elapsed. |
67 static void onAlarm(Alarm alarm); | 79 static void onAlarm(Alarm alarm); |
68 }; | 80 }; |
69 }; | 81 }; |
OLD | NEW |