-
-
Save Happy-Ferret/5669feaf6a0749e849f9b66ce8fe34e4 to your computer and use it in GitHub Desktop.
bare-bones wrapper to convert PalmBus request API to node style callback API.
This file contains hidden or 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
// Simple wrapper to make PamlBus requests. | |
function palmRequest(url, params, callback) { | |
var req = new PalmServiceBridge(); | |
req.onservicecallback = function (result) { | |
var data; | |
try { | |
data = JSON.parse(result); | |
} catch (err) { | |
callback(err); | |
return; | |
} | |
callback(null, data); | |
}; | |
req.call(url, JSON.stringify(params)); | |
} | |
palmRequest("palm://com.palm.location/getCurrentPosition", { accuracy: 1, maximumAge: 0, responseTime: 3 }, function (err, data) { | |
console.log("Final"); | |
if (err) { throw err; } | |
console.log(JSON.stringify(data)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment