You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/03/22 21:43:06 UTC

[7/7] [CB-280] Improve layout of cordova-js scripts

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/ios/notification.js
----------------------------------------------------------------------
diff --git a/lib/plugin/ios/notification.js b/lib/plugin/ios/notification.js
deleted file mode 100644
index a49567d..0000000
--- a/lib/plugin/ios/notification.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var Media = require('cordova/plugin/Media');
-
-module.exports = {
-    beep:function(count) {
-        (new Media('beep.wav')).play();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/network.js
----------------------------------------------------------------------
diff --git a/lib/plugin/network.js b/lib/plugin/network.js
deleted file mode 100644
index 29e1aee..0000000
--- a/lib/plugin/network.js
+++ /dev/null
@@ -1,59 +0,0 @@
-var exec = require('cordova/exec'),
-    cordova = require('cordova'),
-    channel = require('cordova/channel');
-
-var NetworkConnection = function () {
-        this.type = null;
-        this._firstRun = true;
-        this._timer = null;
-        this.timeout = 500;
-
-        var me = this;
-
-        this.getInfo(
-            function (info) {
-                me.type = info;
-                if (info === "none") {
-                    // set a timer if still offline at the end of timer send the offline event
-                    me._timer = setTimeout(function(){
-                        cordova.fireDocumentEvent("offline");
-                        me._timer = null;
-                        }, me.timeout);
-                } else {
-                    // If there is a current offline event pending clear it
-                    if (me._timer !== null) {
-                        clearTimeout(me._timer);
-                        me._timer = null;
-                    }
-                    cordova.fireDocumentEvent("online");
-                }
-
-                // should only fire this once
-                if (me._firstRun) {
-                    me._firstRun = false;
-                    channel.onCordovaConnectionReady.fire();
-                }
-            },
-            function (e) {
-                // If we can't get the network info we should still tell Cordova
-                // to fire the deviceready event.
-                if (me._firstRun) {
-                    me._firstRun = false;
-                    channel.onCordovaConnectionReady.fire();
-                }
-                console.log("Error initializing Network Connection: " + e);
-            });
-};
-
-/**
- * Get connection info
- *
- * @param {Function} successCallback The function to call when the Connection data is available
- * @param {Function} errorCallback The function to call when there is an error getting the Connection data. (OPTIONAL)
- */
-NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) {
-    // Get info
-    exec(successCallback, errorCallback, "Network Status", "getConnectionInfo", []);
-};
-
-module.exports = new NetworkConnection();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/notification.js
----------------------------------------------------------------------
diff --git a/lib/plugin/notification.js b/lib/plugin/notification.js
deleted file mode 100644
index 305ee3d..0000000
--- a/lib/plugin/notification.js
+++ /dev/null
@@ -1,56 +0,0 @@
-var exec = require('cordova/exec');
-
-/**
- * Provides access to notifications on the device.
- */
-
-module.exports = {
-
-    /**
-     * Open a native alert dialog, with a customizable title and button text.
-     *
-     * @param {String} message              Message to print in the body of the alert
-     * @param {Function} completeCallback   The callback that is called when user clicks on a button.
-     * @param {String} title                Title of the alert dialog (default: Alert)
-     * @param {String} buttonLabel          Label of the close button (default: OK)
-     */
-    alert: function(message, completeCallback, title, buttonLabel) {
-        var _title = (title || "Alert");
-        var _buttonLabel = (buttonLabel || "OK");
-        exec(completeCallback, null, "Notification", "alert", [message, _title, _buttonLabel]);
-    },
-
-    /**
-     * Open a native confirm dialog, with a customizable title and button text.
-     * The result that the user selects is returned to the result callback.
-     *
-     * @param {String} message              Message to print in the body of the alert
-     * @param {Function} resultCallback     The callback that is called when user clicks on a button.
-     * @param {String} title                Title of the alert dialog (default: Confirm)
-     * @param {String} buttonLabels         Comma separated list of the labels of the buttons (default: 'OK,Cancel')
-     */
-    confirm: function(message, resultCallback, title, buttonLabels) {
-        var _title = (title || "Confirm");
-        var _buttonLabels = (buttonLabels || "OK,Cancel");
-        exec(resultCallback, null, "Notification", "confirm", [message, _title, _buttonLabels]);
-    },
-
-    /**
-     * Causes the device to vibrate.
-     *
-     * @param {Integer} mills       The number of milliseconds to vibrate for.
-     */
-    vibrate: function(mills) {
-        exec(null, null, "Notification", "vibrate", [mills]);
-    },
-
-    /**
-     * Causes the device to beep.
-     * On Android, the default notification ringtone is played "count" times.
-     *
-     * @param {Integer} count       The number of beeps.
-     */
-    beep: function(count) {
-        exec(null, null, "Notification", "beep", [count]);
-    }
-};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/playbook/device.js
----------------------------------------------------------------------
diff --git a/lib/plugin/playbook/device.js b/lib/plugin/playbook/device.js
deleted file mode 100644
index 90ec376..0000000
--- a/lib/plugin/playbook/device.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var me = {},
-    exec = require('cordova/exec'),
-    channel = require('cordova/channel');
-
-exec(
-    function (device) {
-        me.platform = device.platform;
-        me.version  = device.version;
-        me.name     = device.name;
-        me.uuid     = device.uuid;
-        me.cordova  = device.cordova;
-
-        channel.onCordovaInfoReady.fire();
-    },
-    function (e) {
-        console.log("error initializing cordova: " + e);
-    },
-    "Device",
-    "getDeviceInfo",
-    []
-);
-
-module.exports = me;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/playbook/manager.js
----------------------------------------------------------------------
diff --git a/lib/plugin/playbook/manager.js b/lib/plugin/playbook/manager.js
deleted file mode 100644
index df19a9a..0000000
--- a/lib/plugin/playbook/manager.js
+++ /dev/null
@@ -1,321 +0,0 @@
-var webworks = require('cordova/plugin/webworks/manager'),
-    cordova = require('cordova'),
-    /**
-     * Private list of HTML 5 audio objects, indexed by the Cordova media object ids
-     */
-    audioObjects = {},
-    retInvalidAction = function () {
-        return { "status" : cordova.callbackStatus.INVALID_ACTION, "message" : "Action not found" };
-    },
-    retAsyncCall = function () {
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
-    },
-    batteryAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (action === 'start') {
-                // Register one listener to each of level and state change
-                // events using WebWorks API.
-                blackberry.system.event.deviceBatteryStateChange(function(state) {
-                    var me = navigator.battery;
-                    // state is either CHARGING or UNPLUGGED
-                    if (state === 2 || state === 3) {
-                        var info = {
-                            "level" : me._level,
-                            "isPlugged" : state === 2
-                        };
-
-                        if (me._isPlugged !== info.isPlugged
-                                && typeof win === 'function') {
-                            win(info);
-                        }
-                    }
-                });
-                blackberry.system.event.deviceBatteryLevelChange(function(level) {
-                    var me = navigator.battery;
-                    if (level != me._level && typeof win === 'function') {
-                        win({'level' : level, 'isPlugged' : me._isPlugged});
-                    }
-                });
-            } else if (action === 'stop') {
-                // Unregister battery listeners.
-                blackberry.system.event.deviceBatteryStateChange(null);
-                blackberry.system.event.deviceBatteryLevelChange(null);
-            } else {
-                return retInvalidAction();
-            }
-        }
-    },
-    cameraAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (action === 'takePicture') {
-                blackberry.media.camera.takePicture(win, fail, fail);
-                return retAsyncCall();
-            }
-            else {
-                return retInvalidAction();
-            }
-        }
-    },
-    deviceAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (action === 'getDeviceInfo') {
-                return {"status" : cordova.callbackStatus.OK,
-                        "message" : {
-                            "version" : blackberry.system.softwareVersion,
-                            "name" : blackberry.system.model,
-                            "uuid" : blackberry.identity.PIN,
-                            "platform" : "PlayBook",
-                            "cordova" : "1.4.1"
-                        }
-                };
-            }
-            return retInvalidAction();
-        }
-    },
-    loggerAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (action === 'log') {
-                console.log(args);
-                return {"status" : cordova.callbackStatus.OK,
-                        "message" : 'Message logged to console: ' + args};
-            }
-            else {
-                return retInvalidAction();
-            }
-        }
-    },
-    mediaAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (!args.length) {
-                return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
-            }
-
-            var id = args[0],
-                audio = audioObjects[id],
-                result;
-
-            switch (action) {
-            case 'startPlayingAudio':
-                if (args.length === 1) {
-                    result = {"status" : 9, "message" : "Media source argument not found"};
-
-                }
-
-                if (audio) {
-                    audio.pause();
-                    audioObjects[id] = undefined;
-                }
-
-                audio = audioObjects[id] = new Audio(args[1]);
-                audio.play();
-
-                result = {"status" : 1, "message" : "Audio play started" };
-                break;
-            case 'stopPlayingAudio':
-                if (!audio) {
-                    return {"status" : 2, "message" : "Audio Object has not been initialized"};
-                }
-
-                audio.pause();
-                audioObjects[id] = undefined;
-
-                result = {"status" : 1, "message" : "Audio play stopped" };
-                break;
-            case 'seekToAudio':
-                if (!audio) {
-                    result = {"status" : 2, "message" : "Audio Object has not been initialized"};
-                } else if (args.length === 1) {
-                    result = {"status" : 9, "message" : "Media seek time argument not found"};
-                } else {
-                    try {
-                        audio.currentTime = args[1];
-                    } catch (e) {
-                        console.log('Error seeking audio: ' + e);
-                        return {"status" : 3, "message" : "Error seeking audio: " + e};
-                    }
-
-                    result = {"status" : 1, "message" : "Seek to audio succeeded" };
-                }
-                break;
-            case 'pausePlayingAudio':
-                if (!audio) {
-                    return {"status" : 2, "message" : "Audio Object has not been initialized"};
-                }
-
-                audio.pause();
-
-                result = {"status" : 1, "message" : "Audio paused" };
-                break;
-            case 'getCurrentPositionAudio':
-                if (!audio) {
-                    return {"status" : 2, "message" : "Audio Object has not been initialized"};
-                }
-
-                result = {"status" : 1, "message" : audio.currentTime };
-                break;
-            case 'getDuration':
-                if (!audio) {
-                    return {"status" : 2, "message" : "Audio Object has not been initialized"};
-                }
-
-                result = {"status" : 1, "message" : audio.duration };
-                break;
-            case 'startRecordingAudio':
-                if (args.length <= 1) {
-                    result = {"status" : 9, "message" : "Media start recording, insufficient arguments"};
-                }
-
-                blackberry.media.microphone.record(args[1], win, fail);
-                result = retAsyncCall();
-                break;
-            case 'stopRecordingAudio':
-                break;
-            case 'release':
-                if (audio) {
-                    audioObjects[id] = undefined;
-                    audio.src = undefined;
-                    //delete audio;
-                }
-
-                result = {"status" : 1, "message" : "Media resources released"};
-                break;
-            default:
-                result = retInvalidAction();
-            }
-
-            return result;
-        }
-    },
-    mediaCaptureAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            var limit = args[0],
-                pictureFiles = [],
-                captureMethod;
-
-            function captureCB(filePath) {
-                var mediaFile;
-
-                if (filePath) {
-                    mediaFile = new MediaFile();
-                    mediaFile.fullPath = filePath;
-                    pictureFiles.push(mediaFile);
-                }
-
-                if (limit > 0) {
-                    limit--;
-                    blackberry.media.camera[captureMethod](win, fail, fail);
-                    return;
-                }
-
-                win(pictureFiles);
-
-                return retAsyncCall();
-            }
-
-            switch (action) {
-                case 'getSupportedAudioModes':
-                case 'getSupportedImageModes':
-                case 'getSupportedVideoModes':
-                    return {"status": cordova.callbackStatus.OK, "message": []};
-                case 'captureImage':
-                    captureMethod = "takePicture";
-                    captureCB();
-                    break;
-                case 'captureVideo':
-                    captureMethod = "takeVideo";
-                    captureCB();
-                    break;
-                case 'captureAudio':
-                    return {"status": cordova.callbackStatus.INVALID_ACTION, "message": "captureAudio is not currently supported"};
-            }
-
-            return retAsyncCall();
-        }
-    },
-    networkAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (action !== 'getConnectionInfo') {
-                return retInvalidAction();
-            }
-
-            var connectionType = require("cordova/plugin/Connection").NONE,
-                eventType = "offline",
-                callbackID,
-                request;
-
-            /**
-             * For PlayBooks, we currently only have WiFi connections, so return WiFi if there is
-             * any access at all.
-             * TODO: update if/when PlayBook gets other connection types...
-             */
-            if (blackberry.system.hasDataCoverage()) {
-                connectionType = require("cordova/plugin/Connection").WIFI;
-                eventType = "online";
-            }
-
-            //Register an event handler for the networkChange event
-            callbackID = blackberry.events.registerEventHandler("networkChange", win);
-
-            //pass our callback id down to our network extension
-            request = new blackberry.transport.RemoteFunctionCall("org/apache/cordova/getConnectionInfo");
-            request.addParam("networkStatusChangedID", callbackID);
-            request.makeSyncCall();
-
-            return { "status": cordova.callbackStatus.OK, "message": {"type": connectionType, "event": eventType } };
-        }
-    },
-    notificationAPI = {
-        execute: function (webWorksResult, action, args, win, fail) {
-            if (args.length !== 3) {
-              return {"status" : 9, "message" : "Notification action - " + action + " arguments not found"};
-
-            }
-
-            //Unpack and map the args
-            var msg = args[0],
-                title = args[1],
-                btnLabel = args[2],
-                btnLabels;
-
-            switch (action) {
-            case 'alert':
-                blackberry.ui.dialog.customAskAsync.apply(this, [ msg, [ btnLabel ], win, { "title" : title } ]);
-                return retAsyncCall();
-            case 'confirm':
-                btnLabels = btnLabel.split(",");
-                blackberry.ui.dialog.customAskAsync.apply(this, [msg, btnLabels, win, {"title" : title} ]);
-                return retAsyncCall();
-            }
-            return retInvalidAction();
-
-        }
-    },
-    plugins = {
-        'Battery' : batteryAPI,
-        'Camera' : cameraAPI,
-        'Device' : deviceAPI,
-        'Logger' : loggerAPI,
-        'Media' : mediaAPI,
-        'Capture' : mediaCaptureAPI,
-        'Network Status' : networkAPI,
-        'Notification' : notificationAPI
-    };
-
-module.exports = {
-    exec: function (win, fail, clazz, action, args) {
-        var wwResult = webworks.exec(win, fail, clazz, action, args);
-
-        //We got a sync result or a not found from WW that we can pass on to get a native mixin
-        //For async calls there's nothing to do
-        if ((wwResult.status === cordova.callbackStatus.OK ||
-          wwResult.status === cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION) &&
-          plugins[clazz]) {
-            return plugins[clazz].execute(wwResult.message, action, args, win, fail);
-        }
-
-        return wwResult;
-    },
-    resume: function () {},
-    pause: function () {},
-    destroy: function () {}
-};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/lib/plugin/requestFileSystem.js b/lib/plugin/requestFileSystem.js
deleted file mode 100644
index afee5d7..0000000
--- a/lib/plugin/requestFileSystem.js
+++ /dev/null
@@ -1,40 +0,0 @@
-var FileError = require('cordova/plugin/FileError'),
-    FileSystem = require('cordova/plugin/FileSystem'),
-    exec = require('cordova/exec');
-
-/**
- * Request a file system in which to store application data.
- * @param type  local file system type
- * @param size  indicates how much storage space, in bytes, the application expects to need
- * @param successCallback  invoked with a FileSystem object
- * @param errorCallback  invoked if error occurs retrieving file system
- */
-var requestFileSystem = function(type, size, successCallback, errorCallback) {
-    var fail = function(code) {
-        if (typeof errorCallback === 'function') {
-            errorCallback(new FileError(code));
-        }
-    };
-
-    if (type < 0 || type > 3) {
-        fail(FileError.SYNTAX_ERR);
-    } else {
-        // if successful, return a FileSystem object
-        var success = function(file_system) {
-            if (file_system) {
-                if (typeof successCallback === 'function') {
-                    // grab the name and root from the file system object
-                    var result = new FileSystem(file_system.name, file_system.root);
-                    successCallback(result);
-                }
-            }
-            else {
-                // no FileSystem object returned
-                fail(FileError.NOT_FOUND_ERR);
-            }
-        };
-        exec(success, fail, "File", "requestFileSystem", [type, size]);
-    }
-};
-
-module.exports = requestFileSystem;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/lib/plugin/resolveLocalFileSystemURI.js b/lib/plugin/resolveLocalFileSystemURI.js
deleted file mode 100644
index fbf849b..0000000
--- a/lib/plugin/resolveLocalFileSystemURI.js
+++ /dev/null
@@ -1,41 +0,0 @@
-var DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
-    FileEntry = require('cordova/plugin/FileEntry'),
-    exec = require('cordova/exec');
-
-/**
- * Look up file system Entry referred to by local URI.
- * @param {DOMString} uri  URI referring to a local file or directory
- * @param successCallback  invoked with Entry object corresponding to URI
- * @param errorCallback    invoked if error occurs retrieving file system entry
- */
-module.exports = function(uri, successCallback, errorCallback) {
-    // error callback
-    var fail = function(error) {
-        if (typeof errorCallback === 'function') {
-            errorCallback(new FileError(error));
-        }
-    };
-    // if successful, return either a file or directory entry
-    var success = function(entry) {
-        var result;
-
-        if (entry) {
-            if (typeof successCallback === 'function') {
-                // create appropriate Entry object
-                result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath);
-                try {
-                    successCallback(result);
-                }
-                catch (e) {
-                    console.log('Error invoking callback: ' + e);
-                }
-            }
-        }
-        else {
-            // no Entry object returned
-            fail(FileError.NOT_FOUND_ERR);
-        }
-    };
-
-    exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
-};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/webworks/manager.js
----------------------------------------------------------------------
diff --git a/lib/plugin/webworks/manager.js b/lib/plugin/webworks/manager.js
deleted file mode 100644
index 7ea6592..0000000
--- a/lib/plugin/webworks/manager.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// Define JavaScript plugin implementations that are common across
-// WebWorks platforms (phone/tablet).
-var plugins = {},
-    cordova = require('cordova');
-
-module.exports = {
-    exec: function (win, fail, clazz, action, args) {
-        if (plugins[clazz]) {
-            return plugins[clazz].execute(action, args, win, fail);
-        }
-
-        return {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message" : "Class " + clazz + " cannot be found"};
-    }
-};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/plugin/wp7/device.js
----------------------------------------------------------------------
diff --git a/lib/plugin/wp7/device.js b/lib/plugin/wp7/device.js
deleted file mode 100644
index b51fe93..0000000
--- a/lib/plugin/wp7/device.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
- * phone, etc.
- * @constructor
- */
-var Device = function() 
-{
-    this.platform = null;
-    this.version  = null;
-    this.name     = null;
-    this.phonegap = null;
-    this.uuid     = null;
-    try {      
-	this.platform = DeviceInfo.platform;
-	this.version  = DeviceInfo.version;
-	this.name     = DeviceInfo.name;
-	this.phonegap = DeviceInfo.gap;
-	this.uuid     = DeviceInfo.uuid;
-    } 
-    catch(e) {
-        // TODO: 
-    }
-    this.available = PhoneGap.available = !!this.uuid;
-};
-
-module.exports = new Device();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/require.js
----------------------------------------------------------------------
diff --git a/lib/require.js b/lib/require.js
deleted file mode 100644
index a92249d..0000000
--- a/lib/require.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var require,
-    define;
-
-(function () {
-    var modules = {};
-
-    function build(module) {
-        var factory = module.factory;
-        module.exports = {};
-        delete module.factory;
-        factory(require, module.exports, module);
-        return module.exports;
-    }
-
-    require = function (id) {
-        if (!modules[id]) {
-            throw "module " + id + " not found";
-        }
-        return modules[id].factory ? build(modules[id]) : modules[id].exports;
-    };
-
-    define = function (id, factory) {
-        if (modules[id]) {
-            throw "module " + id + " already defined";
-        }
-
-        modules[id] = {
-            id: id,
-            factory: factory
-        };
-    };
-
-    define.remove = function (id) {
-        delete modules[id];
-    };
-
-})();
-
-//Export for use in node
-if (typeof module === "object" && typeof require === "function") {
-    module.exports.require = require;
-    module.exports.define = define;
-}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/scripts/bootstrap-errgen.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-errgen.js b/lib/scripts/bootstrap-errgen.js
new file mode 100644
index 0000000..cc479e8
--- /dev/null
+++ b/lib/scripts/bootstrap-errgen.js
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+require('cordova/channel').onNativeReady.fire()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/scripts/bootstrap-playbook.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-playbook.js b/lib/scripts/bootstrap-playbook.js
new file mode 100644
index 0000000..19cf867
--- /dev/null
+++ b/lib/scripts/bootstrap-playbook.js
@@ -0,0 +1 @@
+require('cordova/channel').onNativeReady.fire();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/scripts/bootstrap.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap.js b/lib/scripts/bootstrap.js
new file mode 100755
index 0000000..73875ee
--- /dev/null
+++ b/lib/scripts/bootstrap.js
@@ -0,0 +1,69 @@
+(function (context) {
+    var channel = require("cordova/channel"),
+        _self = {
+            boot: function () {
+                //---------------
+                // Event handling
+                //---------------
+
+                /**
+                 * Listen for DOMContentLoaded and notify our channel subscribers.
+                 */
+                document.addEventListener('DOMContentLoaded', function() {
+                    channel.onDOMContentLoaded.fire();
+                }, false);
+                if (document.readyState == 'complete') {
+                  channel.onDOMContentLoaded.fire();
+                }
+
+                /**
+                 * Create all cordova objects once page has fully loaded and native side is ready.
+                 */
+                channel.join(function() {
+                    var builder = require('cordova/builder'),
+                        base = require('cordova/common'),
+                        platform = require('cordova/platform');
+
+                    // Drop the common globals into the window object, but be nice and don't overwrite anything.
+                    builder.build(base.objects).intoButDontClobber(window);
+
+                    // Drop the platform-specific globals into the window object
+                    // and clobber any existing object.
+                    builder.build(platform.objects).intoAndClobber(window);
+
+                    // Merge the platform-specific overrides/enhancements into
+                    // the window object.
+                    if (typeof platform.merges !== 'undefined') {
+                        builder.build(platform.merges).intoAndMerge(window);
+                    }
+
+                    // Call the platform-specific initialization
+                    platform.initialize();
+
+                    // Fire event to notify that all objects are created
+                    channel.onCordovaReady.fire();
+
+                    // Fire onDeviceReady event once all constructors have run and
+                    // cordova info has been received from native side.
+                    channel.join(function() {
+                        channel.onDeviceReady.fire();
+
+                        // Fire the onresume event, since first one happens before JavaScript is loaded
+                        channel.onResume.fire();
+                    }, channel.deviceReadyChannelsArray);
+                    
+                }, [ channel.onDOMContentLoaded, channel.onNativeReady ]);
+            }
+        };
+        
+    // boot up once native side is ready
+    channel.onNativeReady.subscribeOnce(_self.boot);
+
+    // _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();
+    }
+
+}(window));

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/scripts/require.js
----------------------------------------------------------------------
diff --git a/lib/scripts/require.js b/lib/scripts/require.js
new file mode 100644
index 0000000..a92249d
--- /dev/null
+++ b/lib/scripts/require.js
@@ -0,0 +1,43 @@
+var require,
+    define;
+
+(function () {
+    var modules = {};
+
+    function build(module) {
+        var factory = module.factory;
+        module.exports = {};
+        delete module.factory;
+        factory(require, module.exports, module);
+        return module.exports;
+    }
+
+    require = function (id) {
+        if (!modules[id]) {
+            throw "module " + id + " not found";
+        }
+        return modules[id].factory ? build(modules[id]) : modules[id].exports;
+    };
+
+    define = function (id, factory) {
+        if (modules[id]) {
+            throw "module " + id + " already defined";
+        }
+
+        modules[id] = {
+            id: id,
+            factory: factory
+        };
+    };
+
+    define.remove = function (id) {
+        delete modules[id];
+    };
+
+})();
+
+//Export for use in node
+if (typeof module === "object" && typeof require === "function") {
+    module.exports.require = require;
+    module.exports.define = define;
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/test/exec.js
----------------------------------------------------------------------
diff --git a/lib/test/exec.js b/lib/test/exec.js
new file mode 100644
index 0000000..a5d1a69
--- /dev/null
+++ b/lib/test/exec.js
@@ -0,0 +1 @@
+module.exports = jasmine.createSpy();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/utils.js
----------------------------------------------------------------------
diff --git a/lib/utils.js b/lib/utils.js
deleted file mode 100644
index 49f6093..0000000
--- a/lib/utils.js
+++ /dev/null
@@ -1,94 +0,0 @@
-function UUIDcreatePart(length) {
-    var uuidpart = "";
-    for (var i=0; i<length; i++) {
-        var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
-        if (uuidchar.length == 1) {
-            uuidchar = "0" + uuidchar;
-        }
-        uuidpart += uuidchar;
-    }
-    return uuidpart;
-}
-
-var _self = {
-    /**
-     * Does a deep clone of the object.
-     */
-    clone: function(obj) {
-        if(!obj) { 
-            return obj;
-        }
-        
-        var retVal, i;
-        
-        if(obj instanceof Array){
-            retVal = [];
-            for(i = 0; i < obj.length; ++i){
-                retVal.push(_self.clone(obj[i]));
-            }
-            return retVal;
-        }
-        
-        if (obj instanceof Function) {
-            return obj;
-        }
-        
-        if(!(obj instanceof Object)){
-            return obj;
-        }
-        
-        if(obj instanceof Date){
-            return obj;
-        }
-
-        retVal = {};
-        for(i in obj){
-            if(!(i in retVal) || retVal[i] != obj[i]) {
-                retVal[i] = _self.clone(obj[i]);
-            }
-        }
-        return retVal;
-    },
-
-    close: function(context, func, params) {
-        if (typeof params === 'undefined') {
-            return function() {
-                return func.apply(context, arguments);
-            };
-        } else {
-            return function() {
-                return func.apply(context, params);
-            };
-        }
-    },
-
-    /**
-     * Create a UUID
-     */
-    createUUID: function() {
-        return UUIDcreatePart(4) + '-' +
-            UUIDcreatePart(2) + '-' +
-            UUIDcreatePart(2) + '-' +
-            UUIDcreatePart(2) + '-' +
-            UUIDcreatePart(6);
-    },
-
-    /**
-     * Extends a child object from a parent object using classical inheritance
-     * pattern.
-     */
-    extend: (function() {
-        // proxy used to establish prototype chain
-        var F = function() {}; 
-        // extend Child from Parent
-        return function(Child, Parent) {
-            F.prototype = Parent.prototype;
-            Child.prototype = new F();
-            Child.__super__ = Parent.prototype;
-            Child.prototype.constructor = Child;
-        };
-    }())
-
-};
-
-module.exports = _self;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/webworks/plugin/webworks/manager.js
----------------------------------------------------------------------
diff --git a/lib/webworks/plugin/webworks/manager.js b/lib/webworks/plugin/webworks/manager.js
new file mode 100644
index 0000000..7ea6592
--- /dev/null
+++ b/lib/webworks/plugin/webworks/manager.js
@@ -0,0 +1,14 @@
+// Define JavaScript plugin implementations that are common across
+// WebWorks platforms (phone/tablet).
+var plugins = {},
+    cordova = require('cordova');
+
+module.exports = {
+    exec: function (win, fail, clazz, action, args) {
+        if (plugins[clazz]) {
+            return plugins[clazz].execute(action, args, win, fail);
+        }
+
+        return {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message" : "Class " + clazz + " cannot be found"};
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/wp7/exec.js
----------------------------------------------------------------------
diff --git a/lib/wp7/exec.js b/lib/wp7/exec.js
new file mode 100644
index 0000000..78eef40
--- /dev/null
+++ b/lib/wp7/exec.js
@@ -0,0 +1,57 @@
+var cordova = require('cordova');
+
+/**
+ * Execute a cordova command.  It is up to the native side whether this action
+ * is synchronous or asynchronous.  The native side can return:
+ *      Synchronous: PluginResult object as a JSON string
+ *      Asynchrounous: Empty string ""
+ * If async, the native side will cordova.callbackSuccess or cordova.callbackError,
+ * depending upon the result of the action.
+ *
+ * @param {Function} success    The success callback
+ * @param {Function} fail       The fail callback
+ * @param {String} service      The name of the service to use
+ * @param {String} action       Action to be run in cordova
+ * @param {String[]} [args]     Zero or more arguments to pass to the method
+ */
+
+module.exports = function(success, fail, service, action, args) {
+    var callbackId = service + cordova.callbackId++;
+    if (typeof success == "function" || typeof fail == "function") {
+        cordova.callbacks[callbackId] = {success:success, fail:fail};
+    }
+    // generate a new command string, ex. DebugConsole/log/DebugConsole23/{"message":"wtf dude?"}
+     var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args);
+     // pass it on to Notify
+     window.external.Notify(command);
+};
+
+// TODO: is this what native side invokes?
+// if so pluginize under plugin/wp7
+cordovaCommandResult = function(status,callbackId,args,cast) {
+    if(status === "backbutton") {
+
+        cordova.fireEvent(document,"backbutton");
+        return "true";
+
+    } else if(status === "resume") {
+
+        cordova.onResume.fire();
+        return "true";
+
+    } else if(status === "pause") {
+
+        cordova.onPause.fire();
+        return "true";  
+    }
+    
+    var safeStatus = parseInt(status, 10);
+    if(safeStatus === cordova.callbackStatus.NO_RESULT ||
+       safeStatus === cordova.callbackStatus.OK) {
+        cordova.CallbackSuccess(callbackId,args,cast);
+    }
+    else
+    {
+        cordova.CallbackError(callbackId,args,cast);
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/wp7/platform.js
----------------------------------------------------------------------
diff --git a/lib/wp7/platform.js b/lib/wp7/platform.js
new file mode 100644
index 0000000..f2d74b4
--- /dev/null
+++ b/lib/wp7/platform.js
@@ -0,0 +1,16 @@
+module.exports = {
+    id: "wp7",
+    initialize:function() {},
+    objects: {
+        navigator: {
+            children: {
+                device: {
+                    path: "cordova/plugin/wp7/device"
+                }
+            }
+        },
+        device: {
+            path: 'cordova/plugin/wp7/device'
+        }
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/lib/wp7/plugin/wp7/device.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/device.js b/lib/wp7/plugin/wp7/device.js
new file mode 100644
index 0000000..b51fe93
--- /dev/null
+++ b/lib/wp7/plugin/wp7/device.js
@@ -0,0 +1,26 @@
+/**
+ * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the
+ * phone, etc.
+ * @constructor
+ */
+var Device = function() 
+{
+    this.platform = null;
+    this.version  = null;
+    this.name     = null;
+    this.phonegap = null;
+    this.uuid     = null;
+    try {      
+	this.platform = DeviceInfo.platform;
+	this.version  = DeviceInfo.version;
+	this.name     = DeviceInfo.name;
+	this.phonegap = DeviceInfo.gap;
+	this.uuid     = DeviceInfo.uuid;
+    } 
+    catch(e) {
+        // TODO: 
+    }
+    this.available = PhoneGap.available = !!this.uuid;
+};
+
+module.exports = new Device();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/test/runner.js
----------------------------------------------------------------------
diff --git a/test/runner.js b/test/runner.js
index 5e90067..502a726 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -21,8 +21,8 @@ function collect(path, files, matches) {
 
 module.exports = {
     node: function () {
+        console.log('starting node-based tests')
         var jas = require("../thirdparty/jasmine/jasmine"),
-            loader = require('../lib/require'),
             TerminalReporter = require('./reporter').TerminalReporter,
             jsdom, document, window;
 
@@ -41,12 +41,21 @@ module.exports = {
             this[key] = window[key] = global[key] = jas[key];
         });
 
-        //hijack require
-        require = loader.require;
-        define = loader.define;
-
         //load in our modules
-        eval(packager.modules('test'));
+        var testLibName = _path.join(__dirname, '..', 'pkg', 'cordova.test-debug.js')
+        var testLib     = fs.readFileSync(testLibName, 'utf8')
+        try {
+            eval(testLib);
+        }
+        catch (e) {
+            console.log("error eval()ing " + testLibName + ": " + e)
+            console.log(e.stack)
+            throw e
+        }
+
+        //hijack require
+        require = window.cordova.require;
+        define  = window.cordova.define;
 
         //load in our tests
         collect(__dirname, tests);
@@ -65,14 +74,14 @@ module.exports = {
         env.execute();
     },
     browser: function () {
+        console.log('starting browser-based tests')
         var connect = require('connect'),
             html = fs.readFileSync(__dirname + "/suite.html", "utf-8"),
             doc,
             modules,
             specs,
             app = connect(
-                connect.static(__dirname + "/../lib/"),
-                connect.static(__dirname + "/../"),
+                connect.static(_path.join(__dirname, '..', 'thirdparty')),
                 connect.static(__dirname),
                 connect.router(function (app) {
                     app.get('/', function (req, res) {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/e50b7ef6/test/suite.html
----------------------------------------------------------------------
diff --git a/test/suite.html b/test/suite.html
index ce4e392..0e8e58b 100644
--- a/test/suite.html
+++ b/test/suite.html
@@ -3,11 +3,11 @@
 <head>
   <title>EXTERMINATE!</title>
 
-  <link rel="shortcut icon" type="image/png" href="../thirdparty/jasmine/jasmine_favicon.png">
+  <link rel="shortcut icon" type="image/png" href="jasmine/jasmine_favicon.png">
 
-  <link rel="stylesheet" type="text/css" href="../thirdparty/jasmine/jasmine.css">
-  <script type="text/javascript" src="../thirdparty/jasmine/jasmine.js"></script>
-  <script type="text/javascript" src="../thirdparty/jasmine/jasmine-html.js"></script>
+  <link rel="stylesheet" type="text/css" href="jasmine/jasmine.css">
+  <script type="text/javascript" src="jasmine/jasmine.js"></script>
+  <script type="text/javascript" src="jasmine/jasmine-html.js"></script>
 
   <script type="text/javascript">
     (function() {