You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/13 01:40:04 UTC

[1/9] js commit: platform.js

Updated Branches:
  refs/heads/master 6140e1683 -> 579d990af


platform.js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/db0e689b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/db0e689b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/db0e689b

Branch: refs/heads/master
Commit: db0e689bc41db26b910168055c62220869c279ef
Parents: 7d5f6f6
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Aug 16 19:08:12 2013 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Fri Aug 16 19:08:12 2013 +0200

----------------------------------------------------------------------
 lib/firefoxos/platform.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/db0e689b/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
new file mode 100644
index 0000000..a9829c6
--- /dev/null
+++ b/lib/firefoxos/platform.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+module.exports = {
+    id: 'firefoxos',
+    bootstrap: function() {
+        var channel = require('cordova/channel'),
+            cordova = require('cordova'),
+            exec = require('cordova/exec'),
+            modulemapper = require('cordova/modulemapper');
+
+        // Tell the JS that the native side is ready.
+        channel.onNativeReady.fire();
+
+        // TODO: Extract this as a proper plugin.
+        // modulemapper.clobbers('cordova/plugin/firefoxos/app', 'navigator.app');
+
+    }
+};


[7/9] js commit: override init.js in the firefoxos platform for navigator fix, other bugfixes

Posted by st...@apache.org.
override init.js in the firefoxos platform for navigator fix, other bugfixes


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d6603c93
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d6603c93
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d6603c93

Branch: refs/heads/master
Commit: d6603c93aa913eb79366e063e84e03142802f84b
Parents: 6866193
Author: James Long <lo...@gmail.com>
Authored: Wed Aug 21 15:19:08 2013 -0400
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 15:47:24 2013 -0700

----------------------------------------------------------------------
 lib/firefoxos/exec.js     |   3 +
 lib/firefoxos/init.js     | 142 +++++++++++++++++++++++++++++++++++++++++
 lib/firefoxos/platform.js |  12 +---
 3 files changed, 146 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d6603c93/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
new file mode 100644
index 0000000..ab3311b
--- /dev/null
+++ b/lib/firefoxos/exec.js
@@ -0,0 +1,3 @@
+module.exports = function() {
+    console.log('exec not implemented yet');
+}

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d6603c93/lib/firefoxos/init.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/init.js b/lib/firefoxos/init.js
new file mode 100644
index 0000000..b25d4af
--- /dev/null
+++ b/lib/firefoxos/init.js
@@ -0,0 +1,142 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+/*
+ * This file has been copied into the firefoxos platform and patched
+ * to fix a problem with replacing the navigator object. We will have
+ * to keep this file up-to-date with the common init.js.
+ */
+
+var channel = require('cordova/channel');
+var cordova = require('cordova');
+var modulemapper = require('cordova/modulemapper');
+var platform = require('cordova/platform');
+var pluginloader = require('cordova/pluginloader');
+
+var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
+
+function logUnfiredChannels(arr) {
+    for (var i = 0; i < arr.length; ++i) {
+        if (arr[i].state != 2) {
+            console.log('Channel not fired: ' + arr[i].type);
+        }
+    }
+}
+
+window.setTimeout(function() {
+    if (channel.onDeviceReady.state != 2) {
+        console.log('deviceready has not fired after 5 seconds.');
+        logUnfiredChannels(platformInitChannelsArray);
+        logUnfiredChannels(channel.deviceReadyChannelsArray);
+    }
+}, 5000);
+
+// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
+// We replace it so that properties that can't be clobbered can instead be overridden.
+function replaceNavigator(origNavigator) {
+    var CordovaNavigator = function() {};
+    CordovaNavigator.prototype = origNavigator;
+    var newNavigator = new CordovaNavigator();
+    // This work-around really only applies to new APIs that are newer than Function.bind.
+    // Without it, APIs such as getGamepads() break.
+    if (CordovaNavigator.bind) {
+        for (var key in origNavigator) {
+            try {
+                if (typeof origNavigator[key] == 'function') {
+                    newNavigator[key] = origNavigator[key].bind(origNavigator);
+                }
+            } catch(e) {
+                // This try/catch was added for Firefox OS 1.0 and 1.1
+                // because it throws an security exception when trying
+                // to access a few properties of the navigator object.
+                // It has been fixed in 1.2.
+            }
+        }
+    }
+    return newNavigator;
+}
+if (window.navigator) {
+    window.navigator = replaceNavigator(window.navigator);
+}
+
+if (!window.console) {
+    window.console = {
+        log: function(){}
+    };
+}
+if (!window.console.warn) {
+    window.console.warn = function(msg) {
+        this.log("warn: " + msg);
+    };
+}
+
+// Register pause, resume and deviceready channels as events on document.
+channel.onPause = cordova.addDocumentEventHandler('pause');
+channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
+
+// Listen for DOMContentLoaded and notify our channel subscribers.
+if (document.readyState == 'complete' || document.readyState == 'interactive') {
+    channel.onDOMContentLoaded.fire();
+} else {
+    document.addEventListener('DOMContentLoaded', function() {
+        channel.onDOMContentLoaded.fire();
+    }, false);
+}
+
+// _nativeReady is global variable that the native side can set
+// to signify that the native code is ready. It is a global since
+// it may be called before any cordova JS is ready.
+if (window._nativeReady) {
+    channel.onNativeReady.fire();
+}
+
+modulemapper.clobbers('cordova', 'cordova');
+modulemapper.clobbers('cordova/exec', 'cordova.exec');
+modulemapper.clobbers('cordova/exec', 'Cordova.exec');
+
+// Call the platform-specific initialization.
+platform.bootstrap && platform.bootstrap();
+
+pluginloader.load(function() {
+    channel.onPluginsReady.fire();
+});
+
+/**
+ * Create all cordova objects once native side is ready.
+ */
+channel.join(function() {
+    modulemapper.mapModules(window);
+
+    platform.initialize && platform.initialize();
+
+    // Fire event to notify that all objects are created
+    channel.onCordovaReady.fire();
+
+    // Fire onDeviceReady event once page has fully loaded, all
+    // constructors have run and cordova info has been received from native
+    // side.
+    channel.join(function() {
+        require('cordova').fireDocumentEvent('deviceready');
+    }, channel.deviceReadyChannelsArray);
+
+}, platformInitChannelsArray);
+

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d6603c93/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
index a9829c6..4903014 100644
--- a/lib/firefoxos/platform.js
+++ b/lib/firefoxos/platform.js
@@ -22,16 +22,6 @@
 module.exports = {
     id: 'firefoxos',
     bootstrap: function() {
-        var channel = require('cordova/channel'),
-            cordova = require('cordova'),
-            exec = require('cordova/exec'),
-            modulemapper = require('cordova/modulemapper');
-
-        // Tell the JS that the native side is ready.
-        channel.onNativeReady.fire();
-
-        // TODO: Extract this as a proper plugin.
-        // modulemapper.clobbers('cordova/plugin/firefoxos/app', 'navigator.app');
-
+        require('cordova/channel').onNativeReady.fire();
     }
 };


[6/9] js commit: platform.js

Posted by st...@apache.org.
platform.js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/01119a9a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/01119a9a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/01119a9a

Branch: refs/heads/master
Commit: 01119a9a2b60d83c9cbda4bfb450f313dcfc73b3
Parents: e2942e1
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Aug 16 19:08:12 2013 +0200
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 15:47:23 2013 -0700

----------------------------------------------------------------------
 lib/firefoxos/platform.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/01119a9a/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
new file mode 100644
index 0000000..a9829c6
--- /dev/null
+++ b/lib/firefoxos/platform.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+module.exports = {
+    id: 'firefoxos',
+    bootstrap: function() {
+        var channel = require('cordova/channel'),
+            cordova = require('cordova'),
+            exec = require('cordova/exec'),
+            modulemapper = require('cordova/modulemapper');
+
+        // Tell the JS that the native side is ready.
+        channel.onNativeReady.fire();
+
+        // TODO: Extract this as a proper plugin.
+        // modulemapper.clobbers('cordova/plugin/firefoxos/app', 'navigator.app');
+
+    }
+};


[2/9] js commit: add firefoxos to gruntfile

Posted by st...@apache.org.
add firefoxos to gruntfile


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/c8a03133
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/c8a03133
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/c8a03133

Branch: refs/heads/master
Commit: c8a0313389c657d2a65254416fd6f68d5a7dd851
Parents: db0e689
Author: James Long <lo...@gmail.com>
Authored: Fri Aug 16 13:19:33 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Fri Aug 16 13:19:33 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c8a03133/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 94da640..9afeded 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -32,6 +32,7 @@ module.exports = function(grunt) {
           "test": {},
           "windows8": { useWindowsLineEndings: true },
           "windowsphone": { useWindowsLineEndings: true },
+          "firefoxos": {}
         },
         clean: ['pkg'],
         jshint: {


[8/9] js commit: fixed merge issues

Posted by st...@apache.org.
fixed merge issues


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/06273088
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/06273088
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/06273088

Branch: refs/heads/master
Commit: 06273088134dcad7058e7382c3482f904d38ac63
Parents: d6603c9 0bc7da8
Author: Steven Gill <st...@gmail.com>
Authored: Wed Sep 11 16:30:31 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 16:30:31 2013 -0700

----------------------------------------------------------------------
 lib/firefoxos/exec.js     | 32 +++++++++++++++++++++++++++++---
 lib/firefoxos/platform.js | 13 +++++++++++++
 2 files changed, 42 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/06273088/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --cc lib/firefoxos/exec.js
index ab3311b,d9d958a..a41d5df
--- a/lib/firefoxos/exec.js
+++ b/lib/firefoxos/exec.js
@@@ -1,3 -1,8 +1,29 @@@
- module.exports = function() {
-     console.log('exec not implemented yet');
- }
++/*
++ *
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements.  See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership.  The ASF licenses this file
++ * to you under the Apache License, Version 2.0 (the
++ * "License"); you may not use this file except in compliance
++ * with the License.  You may obtain a copy of the License at
++ *
++ *   http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing,
++ * software distributed under the License is distributed on an
++ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied.  See the License for the
++ * specific language governing permissions and limitations
++ * under the License.
++ *
++*/
++
+ var firefoxos = require('cordova/platform');
+ 
+ module.exports = function(success, fail, service, action, actionArgs) {
+     var plugin = firefoxos.getPlugin(service);
+     actionArgs.unshift(fail);
+     actionArgs.unshift(success);
+     plugin[action].apply(plugin, actionArgs);
+ };


[9/9] js commit: Merge branch 'master' into ffos

Posted by st...@apache.org.
Merge branch 'master' into ffos


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/579d990a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/579d990a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/579d990a

Branch: refs/heads/master
Commit: 579d990af6d691a8e92ea9794f443d97aa71dd56
Parents: 0627308 6140e16
Author: Steven Gill <st...@gmail.com>
Authored: Thu Sep 12 16:39:15 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Sep 12 16:39:15 2013 -0700

----------------------------------------------------------------------
 build/packager.js | 44 ++++++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------



[3/9] js commit: override init.js in the firefoxos platform for navigator fix, other bugfixes

Posted by st...@apache.org.
override init.js in the firefoxos platform for navigator fix, other bugfixes


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/3be32a33
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/3be32a33
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/3be32a33

Branch: refs/heads/master
Commit: 3be32a335de9e1297b8e268c90af9dfb0ba02883
Parents: c8a0313
Author: James Long <lo...@gmail.com>
Authored: Wed Aug 21 15:19:08 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Wed Aug 21 15:19:08 2013 -0400

----------------------------------------------------------------------
 lib/firefoxos/exec.js     |   3 +
 lib/firefoxos/init.js     | 142 +++++++++++++++++++++++++++++++++++++++++
 lib/firefoxos/platform.js |  12 +---
 3 files changed, 146 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3be32a33/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
new file mode 100644
index 0000000..ab3311b
--- /dev/null
+++ b/lib/firefoxos/exec.js
@@ -0,0 +1,3 @@
+module.exports = function() {
+    console.log('exec not implemented yet');
+}

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3be32a33/lib/firefoxos/init.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/init.js b/lib/firefoxos/init.js
new file mode 100644
index 0000000..b25d4af
--- /dev/null
+++ b/lib/firefoxos/init.js
@@ -0,0 +1,142 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+/*
+ * This file has been copied into the firefoxos platform and patched
+ * to fix a problem with replacing the navigator object. We will have
+ * to keep this file up-to-date with the common init.js.
+ */
+
+var channel = require('cordova/channel');
+var cordova = require('cordova');
+var modulemapper = require('cordova/modulemapper');
+var platform = require('cordova/platform');
+var pluginloader = require('cordova/pluginloader');
+
+var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
+
+function logUnfiredChannels(arr) {
+    for (var i = 0; i < arr.length; ++i) {
+        if (arr[i].state != 2) {
+            console.log('Channel not fired: ' + arr[i].type);
+        }
+    }
+}
+
+window.setTimeout(function() {
+    if (channel.onDeviceReady.state != 2) {
+        console.log('deviceready has not fired after 5 seconds.');
+        logUnfiredChannels(platformInitChannelsArray);
+        logUnfiredChannels(channel.deviceReadyChannelsArray);
+    }
+}, 5000);
+
+// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
+// We replace it so that properties that can't be clobbered can instead be overridden.
+function replaceNavigator(origNavigator) {
+    var CordovaNavigator = function() {};
+    CordovaNavigator.prototype = origNavigator;
+    var newNavigator = new CordovaNavigator();
+    // This work-around really only applies to new APIs that are newer than Function.bind.
+    // Without it, APIs such as getGamepads() break.
+    if (CordovaNavigator.bind) {
+        for (var key in origNavigator) {
+            try {
+                if (typeof origNavigator[key] == 'function') {
+                    newNavigator[key] = origNavigator[key].bind(origNavigator);
+                }
+            } catch(e) {
+                // This try/catch was added for Firefox OS 1.0 and 1.1
+                // because it throws an security exception when trying
+                // to access a few properties of the navigator object.
+                // It has been fixed in 1.2.
+            }
+        }
+    }
+    return newNavigator;
+}
+if (window.navigator) {
+    window.navigator = replaceNavigator(window.navigator);
+}
+
+if (!window.console) {
+    window.console = {
+        log: function(){}
+    };
+}
+if (!window.console.warn) {
+    window.console.warn = function(msg) {
+        this.log("warn: " + msg);
+    };
+}
+
+// Register pause, resume and deviceready channels as events on document.
+channel.onPause = cordova.addDocumentEventHandler('pause');
+channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
+
+// Listen for DOMContentLoaded and notify our channel subscribers.
+if (document.readyState == 'complete' || document.readyState == 'interactive') {
+    channel.onDOMContentLoaded.fire();
+} else {
+    document.addEventListener('DOMContentLoaded', function() {
+        channel.onDOMContentLoaded.fire();
+    }, false);
+}
+
+// _nativeReady is global variable that the native side can set
+// to signify that the native code is ready. It is a global since
+// it may be called before any cordova JS is ready.
+if (window._nativeReady) {
+    channel.onNativeReady.fire();
+}
+
+modulemapper.clobbers('cordova', 'cordova');
+modulemapper.clobbers('cordova/exec', 'cordova.exec');
+modulemapper.clobbers('cordova/exec', 'Cordova.exec');
+
+// Call the platform-specific initialization.
+platform.bootstrap && platform.bootstrap();
+
+pluginloader.load(function() {
+    channel.onPluginsReady.fire();
+});
+
+/**
+ * Create all cordova objects once native side is ready.
+ */
+channel.join(function() {
+    modulemapper.mapModules(window);
+
+    platform.initialize && platform.initialize();
+
+    // Fire event to notify that all objects are created
+    channel.onCordovaReady.fire();
+
+    // Fire onDeviceReady event once page has fully loaded, all
+    // constructors have run and cordova info has been received from native
+    // side.
+    channel.join(function() {
+        require('cordova').fireDocumentEvent('deviceready');
+    }, channel.deviceReadyChannelsArray);
+
+}, platformInitChannelsArray);
+

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3be32a33/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
index a9829c6..4903014 100644
--- a/lib/firefoxos/platform.js
+++ b/lib/firefoxos/platform.js
@@ -22,16 +22,6 @@
 module.exports = {
     id: 'firefoxos',
     bootstrap: function() {
-        var channel = require('cordova/channel'),
-            cordova = require('cordova'),
-            exec = require('cordova/exec'),
-            modulemapper = require('cordova/modulemapper');
-
-        // Tell the JS that the native side is ready.
-        channel.onNativeReady.fire();
-
-        // TODO: Extract this as a proper plugin.
-        // modulemapper.clobbers('cordova/plugin/firefoxos/app', 'navigator.app');
-
+        require('cordova/channel').onNativeReady.fire();
     }
 };


[4/9] js commit: implement exec for firefoxos

Posted by st...@apache.org.
implement exec for firefoxos


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0bc7da8b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0bc7da8b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0bc7da8b

Branch: refs/heads/master
Commit: 0bc7da8b13db556e851362443bf41122bad8c9dc
Parents: 3be32a3
Author: James Long <lo...@gmail.com>
Authored: Wed Sep 11 16:34:38 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Wed Sep 11 16:34:50 2013 -0400

----------------------------------------------------------------------
 lib/firefoxos/exec.js     | 11 ++++++++---
 lib/firefoxos/platform.js | 13 +++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0bc7da8b/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
index ab3311b..d9d958a 100644
--- a/lib/firefoxos/exec.js
+++ b/lib/firefoxos/exec.js
@@ -1,3 +1,8 @@
-module.exports = function() {
-    console.log('exec not implemented yet');
-}
+var firefoxos = require('cordova/platform');
+
+module.exports = function(success, fail, service, action, actionArgs) {
+    var plugin = firefoxos.getPlugin(service);
+    actionArgs.unshift(fail);
+    actionArgs.unshift(success);
+    plugin[action].apply(plugin, actionArgs);
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0bc7da8b/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
index 4903014..b7158d8 100644
--- a/lib/firefoxos/platform.js
+++ b/lib/firefoxos/platform.js
@@ -19,9 +19,22 @@
  *
 */
 
+var plugins = {};
+
 module.exports = {
     id: 'firefoxos',
+    cordovaVersion: '3.0.0',
+
     bootstrap: function() {
         require('cordova/channel').onNativeReady.fire();
+    },
+
+    registerPlugin: function(name, plugin) {
+        plugins[name] = plugin;
+        console.log('registered ' + name);
+    },
+
+    getPlugin: function(name) {
+        return plugins[name];
     }
 };


[5/9] js commit: add firefoxos to gruntfile

Posted by st...@apache.org.
add firefoxos to gruntfile


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/6866193d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/6866193d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/6866193d

Branch: refs/heads/master
Commit: 6866193d2a0947c3dd35a55e11b5ec69f8e225cc
Parents: 01119a9
Author: James Long <lo...@gmail.com>
Authored: Fri Aug 16 13:19:33 2013 -0400
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 15:47:23 2013 -0700

----------------------------------------------------------------------
 Gruntfile.js | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/6866193d/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 94da640..9afeded 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -32,6 +32,7 @@ module.exports = function(grunt) {
           "test": {},
           "windows8": { useWindowsLineEndings: true },
           "windowsphone": { useWindowsLineEndings: true },
+          "firefoxos": {}
         },
         clean: ['pkg'],
         jshint: {