This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[exposed=Window&Worker] | |
partial interface Navigator { | |
readonly attribute Geofencing geofencing; | |
}; | |
partial interface ServiceWorkerGlobalScope | |
{ | |
attribute EventHandler ongeofenceenter; | |
attribute EventHandler ongeofenceleave; | |
}; | |
[NoInterfaceObject] | |
interface GeofencingEvent { | |
readonly attribute GeofencingRegion region; | |
readonly attribute Position position; | |
} | |
[NoInterfaceObject] | |
interface Geofencing { | |
Promise<undefined> registerRegion(GeofencingRegion region); | |
Promise<undefined> unregisterRegion(DOMString regionId); | |
Promise<sequence<GeofencingRegion>> getRegisteredRegions(); | |
Promise<GeofencingRegionState> getRegionState(DOMString regionId); | |
}; | |
dictionary GeofencingRegionState { | |
readonly attribute GeofencingRegion region; | |
readonly attribute DOMString state; // "inside", "outside" | |
}; | |
[NoInterfaceObject] | |
interface GeofencingRegion { | |
readonly attribute DOMString id; | |
}; | |
dictionary GeolocationPoint { | |
double latitude; | |
double longitude; | |
double? altitude; | |
}; | |
[Constructor(optional String? id, dictionary options), exposed=Window&Worker] | |
interface CircularRegion : GeofencingRegion { | |
const double MIN_RADIUS = 10; | |
const double MAX_RADIUS = 1000; | |
readonly attribute GeolocationPoint center; | |
readonly attribute double radius; | |
}; | |
// Other potential region types: | |
// Polygon of nonintersecting line segments. | |
[Constructor(optional String? id, dictionary options), exposed=Window&Worker] | |
interface PolygonRegion : GeofencingRegion { | |
readonly attribute sequence<GeolocationPoint> points; | |
}; | |
// A region centered around whatever the current location of the device is | |
[Constructor(optional String? id, dictionary options), exposed=Window&Worker] | |
interface CurrentLocationRegion : GeofencingRegion { | |
readonly attribute double radius; | |
}; | |
// Show some UI to let the user select a region. Not sure if this makes sense, | |
// and not sure what the use case would be. | |
[Constructor(optional String? id), exposed=Window&Worker] | |
interface UserSelectedRegion : GeofencingRegion { | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment