1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "alarms",
"permissions": ["alarms"],
"types": [
{
"id": "Alarm",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of this alarm."
},
"scheduledTime": {
"type": "number",
"description": "Time when the alarm is scheduled to fire, in milliseconds past the epoch."
},
"periodInMinutes": {
"type": "number",
"optional": true,
"description": "When present, signals that the alarm triggers periodically after so many minutes."
}
}
}
],
"functions": [
{
"name": "create",
"type": "function",
"description": "Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.",
"parameters": [
{
"type": "string",
"name": "name",
"optional": true,
"description": "Optional name to identify this alarm. Defaults to the empty string."
},
{
"type": "object",
"name": "alarmInfo",
"description": "Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.",
"properties": {
"when": {"type": "number", "optional": true,
"description": "Time when the alarm is scheduled to first fire, in milliseconds past the epoch."},
"delayInMinutes": {"type": "number", "optional": true,
"description": "Number of minutes from the current time after which the alarm should first fire."},
"periodInMinutes": {"type": "number", "optional": true,
"description": "Number of minutes after which the alarm should recur repeatedly."}
}
}
]
},
{
"name": "get",
"type": "function",
"description": "Retrieves details about the specified alarm.",
"async": "callback",
"parameters": [
{
"type": "string",
"name": "name",
"optional": true,
"description": "The name of the alarm to get. Defaults to the empty string."
},
{
"type": "function",
"name": "callback",
"parameters": [
{ "name": "alarm", "$ref": "Alarm" }
]
}
]
},
{
"name": "getAll",
"type": "function",
"description": "Gets an array of all the alarms.",
"async": "callback",
"parameters": [
{
"type": "function",
"name": "callback",
"parameters": [
{ "name": "alarms", "type": "array", "items": { "$ref": "Alarm" } }
]
}
]
},
{
"name": "clear",
"type": "function",
"description": "Clears the alarm with the given name.",
"async": "callback",
"parameters": [
{
"type": "string",
"name": "name",
"optional": true,
"description": "The name of the alarm to clear. Defaults to the empty string."
},
{
"type": "function",
"name": "callback",
"parameters": [
{ "name": "wasCleared", "type": "boolean", "description": "Whether an alarm of the given name was found to clear." }
]
}
]
},
{
"name": "clearAll",
"type": "function",
"description": "Clears all alarms.",
"async": "callback",
"parameters": [
{
"type": "function",
"name": "callback",
"parameters": [
{ "name": "wasCleared", "type": "boolean", "description": "Whether any alarm was found to clear." }
]
}
]
}
],
"events": [
{
"name": "onAlarm",
"type": "function",
"description": "Fired when an alarm has expired. Useful for transient background pages.",
"parameters": [
{
"name": "name",
"$ref": "Alarm",
"description": "The alarm that has expired."
}
]
}
]
}
]
|