diff options
Diffstat (limited to 'daemon/jskitmanager.cpp')
| -rw-r--r-- | daemon/jskitmanager.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/daemon/jskitmanager.cpp b/daemon/jskitmanager.cpp index 7bf8cdc..70ea4bd 100644 --- a/daemon/jskitmanager.cpp +++ b/daemon/jskitmanager.cpp @@ -103,6 +103,7 @@ void JSKitManager::startJsApp() _jspebble = new JSKitPebble(_curApp, this); _jsconsole = new JSKitConsole(this); _jsstorage = new JSKitLocalStorage(_curApp.uuid(), this); + _jsgeo = new JSKitGeolocation(this); logger()->debug() << "starting JS app"; @@ -116,6 +117,10 @@ void JSKitManager::startJsApp() windowObj.setProperty("localStorage", globalObj.property("localStorage")); globalObj.setProperty("window", windowObj); + QJSValue navigatorObj = _engine->newObject(); + navigatorObj.setProperty("geolocation", _engine->newQObject(_jsgeo)); + globalObj.setProperty("navigator", navigatorObj); + _engine->evaluate("function XMLHttpRequest() { return Pebble.createXMLHttpRequest(); }"); QFile scriptFile(_curApp.path() + "/pebble-js-app.js"); @@ -151,4 +156,6 @@ void JSKitManager::stopJsApp() _jsstorage = 0; delete _jspebble; _jspebble = 0; + delete _jsgeo; + _jsgeo = 0; } |
