MozNetworkStatsManager.addAlarm()
This API is available on Firefox OS for internal applications only.
Summary
The addAlarm
method installs an alarm on a network. When total data usage reaches threshold bytes, a "networkstats-alarm" system message is sent to the application, where the optional parameter data must be a cloneable object.
Syntax
JavaScript
Copy Code
var alarm = addAlarm(network, threshold, options);
Parameters
network
- The origin of the data. It can specify wifi, mobile, or null. If null, data measurement from both origins are merged. To know in advance which kind of origin is available, the
MozNetworkStatsManager.getAvailableNetworks
method returns an Array of interfaces. threshold
- The total data usage threshold in bytes.
options
Optional- Filtering options.
- NetworkStatsAlarmOptions is a dictionary object providing filtering options.
Return
A DOMRequest
object. If successful, the result
field of the DOMRequest
keeps the alarm Id.
Exceptions
- InvalidNetwork
- The
network
must be in the return ofMozNetworkStatsManager.getAvailableNetworks
.
Specifications
Not part of any specification.
See also
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/moznetworkstatsmanager/addalarm