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 experimental.alarms { | 8 namespace experimental.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 seconds after which the onAlarm event should | 13 // Original length of time in minutes after which the onAlarm event should |
14 // fire. | 14 // fire. |
15 // TODO: need minimum=0 | 15 // TODO: need minimum=0 |
16 long delayInSeconds; | 16 double delayInMinutes; |
17 | 17 |
18 // True if the alarm repeatedly fires at regular intervals, false if it | 18 // True if the alarm repeatedly fires at regular intervals, false if it |
19 // only fires once. | 19 // only fires once. |
20 boolean repeating; | 20 boolean repeating; |
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 // Length of time in seconds after which the onAlarm event should fire. | 26 // 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 | 27 // 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 | 28 // the browser. For performance reasons, alarms may be delayed an arbitrary |
29 // amount of time before firing. | 29 // amount of time before firing. |
30 // TODO: need minimum=0 | 30 // TODO: need minimum=0 |
31 long delayInSeconds; | 31 double delayInMinutes; |
32 | 32 |
33 // True if the alarm should repeatedly fire at regular intervals. Defaults | 33 // True if the alarm should repeatedly fire at regular intervals. Defaults |
34 // to false. | 34 // to false. |
35 boolean? repeating; | 35 boolean? repeating; |
36 }; | 36 }; |
37 | 37 |
38 callback AlarmCallback = void (Alarm alarm); | 38 callback AlarmCallback = void (Alarm alarm); |
39 callback AlarmListCallback = void (Alarm[] alarms); | 39 callback AlarmListCallback = void (Alarm[] alarms); |
40 | 40 |
41 interface Functions { | 41 interface Functions { |
(...skipping 18 matching lines...) Expand all Loading... |
60 // Clears all alarms. | 60 // Clears all alarms. |
61 static void clearAll(); | 61 static void clearAll(); |
62 }; | 62 }; |
63 | 63 |
64 interface Events { | 64 interface Events { |
65 // Fired when an alarm has elapsed. Useful for transient background pages. | 65 // Fired when an alarm has elapsed. Useful for transient background pages. |
66 // |alarm|: The alarm that has elapsed. | 66 // |alarm|: The alarm that has elapsed. |
67 static void onAlarm(Alarm alarm); | 67 static void onAlarm(Alarm alarm); |
68 }; | 68 }; |
69 }; | 69 }; |
OLD | NEW |