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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // In order to reduce the load on the user's machine, Chrome limits alarms | 52 // In order to reduce the load on the user's machine, Chrome limits alarms |
53 // to at most once every 1 minute but may delay them an arbitrary amount | 53 // to at most once every 1 minute but may delay them an arbitrary amount |
54 // more. That is, setting <code>$ref:[alarms.AlarmCreateInfo.delayInMinutes | 54 // more. That is, setting <code>delayInMinutes</code> or |
55 // delayInMinutes]</code> or | 55 // <code>periodInMinutes</code> to less than <code>1</code> will not be |
56 // <code>$ref:[alarms.AlarmCreateInfo.periodInMinutes | 56 // honored and will cause a warning. <code>when</code> can be set to less |
57 // periodInMinutes]</code> to less than <code>1</code> will not be honored | 57 // than 1 minute after "now" without warning but won't actually cause the |
58 // and will cause a warning. <code>$ref:[alarms.AlarmCreateInfo.when | 58 // alarm to fire for at least 1 minute. |
59 // when]</code> can be set to less than 1 minute after "now" without | |
60 // warning but won't actually cause the alarm to fire for at least 1 minute. | |
61 // | 59 // |
62 // To help you debug your app or extension, when you've loaded it unpacked, | 60 // 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. | 61 // there's no limit to how often the alarm can fire. |
64 // | 62 // |
65 // |name|: Optional name to identify this alarm. Defaults to the empty | 63 // |name|: Optional name to identify this alarm. Defaults to the empty |
66 // string. | 64 // string. |
67 // | 65 // |
68 // |alarmInfo|: Describes when the alarm should fire. The initial time must | 66 // |alarmInfo|: Describes when the alarm should fire. The initial time must |
69 // be specified by either <var>when</var> or <var>delayInMinutes</var> (but | 67 // be specified by either <var>when</var> or <var>delayInMinutes</var> (but |
70 // not both). If <var>periodInMinutes</var> is set, the alarm will repeat | 68 // not both). If <var>periodInMinutes</var> is set, the alarm will repeat |
(...skipping 17 matching lines...) Expand all Loading... |
88 // Clears all alarms. | 86 // Clears all alarms. |
89 static void clearAll(); | 87 static void clearAll(); |
90 }; | 88 }; |
91 | 89 |
92 interface Events { | 90 interface Events { |
93 // Fired when an alarm has elapsed. Useful for event pages. | 91 // Fired when an alarm has elapsed. Useful for event pages. |
94 // |alarm|: The alarm that has elapsed. | 92 // |alarm|: The alarm that has elapsed. |
95 static void onAlarm(Alarm alarm); | 93 static void onAlarm(Alarm alarm); |
96 }; | 94 }; |
97 }; | 95 }; |
OLD | NEW |