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": "create", | |
25 "type": "function", | |
26 "description": "Creates an alarm. After the delay is expired, the onAlar
m event is fired. If there is another alarm with the same name (or no name if no
ne is specified), it will be cancelled and replaced by this alarm.", | |
27 "parameters": [ | |
28 { | |
29 "type": "string", | |
30 "name": "name", | |
31 "optional": true, | |
32 "description": "Optional name to identify this alarm. Defaults to th
e empty string." | |
33 }, | |
34 { | |
35 "type": "object", | |
36 "name": "alarmInfo", | |
37 "properties": { | |
38 "delayInSeconds": {"type": "integer", "minimum": "0", | |
39 "description": "Length of time in seconds after which the onAlar
m event should fire. Note that granularity is not guaranteed: this value is more
of a hint to the browser. For performance reasons, alarms may be delayed an arb
itrary amount of time before firing."}, | |
40 "repeating": {"type": "boolean", "optional": true, | |
41 "description": "True if the alarm should repeatedly fire at regu
lar intervals. Defaults to false."} | |
42 } | |
43 } | |
44 ] | |
45 }, | |
46 { | |
47 "name": "get", | |
48 "type": "function", | |
49 "description": "Retrieves details about the specified alarm.", | |
50 "parameters": [ | |
51 { | |
52 "type": "string", | |
53 "name": "name", | |
54 "optional": true, | |
55 "description": "The name of the alarm to get. Defaults to the empty
string." | |
56 }, | |
57 { | |
58 "type": "function", | |
59 "name": "callback", | |
60 "parameters": [ | |
61 { "name": "alarm", "$ref": "Alarm" } | |
62 ] | |
63 } | |
64 ] | |
65 }, | |
66 { | |
67 "name": "getAll", | |
68 "type": "function", | |
69 "description": "Gets an array of all the alarms.", | |
70 "parameters": [ | |
71 { | |
72 "type": "function", | |
73 "name": "callback", | |
74 "parameters": [ | |
75 { "name": "alarms", "type": "array", "items": { "$ref": "Alarm" }
} | |
76 ] | |
77 } | |
78 ] | |
79 }, | |
80 { | |
81 "name": "clear", | |
82 "type": "function", | |
83 "description": "Clears the alarm with the given name.", | |
84 "parameters": [ | |
85 { | |
86 "type": "string", | |
87 "name": "name", | |
88 "optional": true, | |
89 "description": "The name of the alarm to clear. Defaults to the empt
y string." | |
90 } | |
91 ] | |
92 }, | |
93 { | |
94 "name": "clearAll", | |
95 "type": "function", | |
96 "description": "Clears all alarms.", | |
97 "parameters": [] | |
98 } | |
99 ], | |
100 "events": [ | |
101 { | |
102 "name": "onAlarm", | |
103 "type": "function", | |
104 "description": "Fired when an alarm has expired. Useful for transient ba
ckground pages.", | |
105 "parameters": [ | |
106 { | |
107 "type": "string", | |
108 "name": "name", | |
109 "optional": true, | |
110 "description": "The name of the alarm that has expired." | |
111 } | |
112 ] | |
113 } | |
114 ] | |
115 } | |
116 ] | |
OLD | NEW |