pluotsorbet/tests/index.js.in

41 строка
956 B
JavaScript

DumbPipe.registerOpener("echo", function(message, sender) {
sender(message);
});
// Generate faked location data for tests
// #if JSR_179 == 1
LocationProvider.AVAILABLE = 1;
DumbPipe.registerOpener("locationprovider", function(message, sender) {
return function(message) {
switch (message.type) {
case "requestData":
sender({
type: "data",
position: {
timestamp: Date.now(),
latitude: 45,
longitude: -122,
altitude: 500,
horizontalAccuracy: 200,
verticalAccuracy: 10,
speed: 90,
course: 2
},
state: LocationProvider.AVAILABLE
});
break;
}
};
});
// #endif
var backgroundChecks = 0;
DumbPipe.registerOpener("backgroundCheck", function() {
backgroundChecks++;
});
DumbPipe.registerOpener("getBackgroundChecks", function(message, sender) {
sender(backgroundChecks);
});