OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 [ | |
6 { | |
7 "namespace": "experimental.alarms", | |
8 "types": [ | |
9 { | |
10 "id": "Alarm", | |
11 "type": "object", | |
12 "properties": { | |
13 "name": {"type": "string", | |
14 "description": "Name of this alarm."}, | |
15 "delayInSeconds": {"type": "integer", "minimum": "0", | |
16 "description": "Original length of time in seconds after which the o nAlarm event should fire."}, | |
17 "repeating": {"type": "boolean", | |
18 "description": "True if the alarm repeatedly fires at regular interv als, false if it only fires once."} | |
19 } | |
20 } | |
21 ], | |
22 "functions": [ | |
23 { | |
24 "name": "set", | |
Aaron Boodman
2012/03/27 23:34:01
Seems like "create" would be a better name.
Matt Perry
2012/03/28 00:33:03
Done.
| |
25 "type": "function", | |
26 "description": "Sets an alarm. After the delay is expired, the onAlarm e vent is fired. If there is another alarm with the same name (or no name if none is specified), it will be overridden by this alarm.", | |
27 "parameters": [ | |
28 { | |
29 "type": "object", | |
30 "name": "alarmInfo", | |
31 "properties": { | |
32 "name": {"type": "string", "optional": true, | |
Aaron Boodman
2012/03/27 23:34:01
Did you consider making the name a separate formal
Matt Perry
2012/03/28 00:33:03
Done.
| |
33 "description": "Optional name to identify this alarm. Defaults t o \"default\"."}, | |
34 "delayInSeconds": {"type": "integer", "minimum": "0", | |
35 "description": "Length of time in seconds after which the onAlar m event should fire. Note that granularity is not guaranteed: up to a minute may pass before the alarm is finally triggered."}, | |
36 "repeating": {"type": "boolean", "optional": true, | |
37 "description": "True if the alarm should repeatedly fire at regu lar intervals. Defaults to false."} | |
38 } | |
39 } | |
40 ] | |
41 }, | |
42 { | |
43 "name": "get", | |
44 "type": "function", | |
45 "description": "Retrieves details about the specified alarm.", | |
46 "parameters": [ | |
47 { | |
48 "type": "string", | |
49 "name": "name", | |
50 "optional": true, | |
51 "description": "The name of the alarm to get. Defaults to \"default\ "." | |
52 }, | |
53 { | |
54 "type": "function", | |
55 "name": "callback", | |
56 "parameters": [ | |
57 { "name": "alarm", "$ref": "Alarm" } | |
58 ] | |
59 } | |
60 ] | |
61 }, | |
62 { | |
63 "name": "getAll", | |
64 "type": "function", | |
65 "description": "Gets an array of all the alarms.", | |
66 "parameters": [ | |
67 { | |
68 "type": "function", | |
69 "name": "callback", | |
70 "parameters": [ | |
71 { "name": "alarms", "type": "array", "items": { "$ref": "Alarm" } } | |
72 ] | |
73 } | |
74 ] | |
75 }, | |
76 { | |
77 "name": "clear", | |
78 "type": "function", | |
79 "description": "Clears the alarm with the given name.", | |
80 "parameters": [ | |
81 { | |
82 "type": "string", | |
83 "name": "name", | |
84 "optional": true, | |
85 "description": "The name of the alarm to clear. Defaults to \"defaul t\"." | |
86 } | |
87 ] | |
88 }, | |
89 { | |
90 "name": "clearAll", | |
91 "type": "function", | |
92 "description": "Clears all alarms.", | |
93 "parameters": [] | |
94 } | |
95 ], | |
96 "events": [ | |
97 { | |
98 "name": "onAlarm", | |
99 "type": "function", | |
100 "description": "Fired when an alarm has expired. Useful for transient ba ckground pages.", | |
101 "parameters": [ | |
102 { | |
103 "type": "string", | |
104 "name": "name", | |
105 "optional": true, | |
106 "description": "The name of the alarm that has expired." | |
107 } | |
108 ] | |
109 } | |
110 ] | |
111 } | |
112 ] | |
OLD | NEW |