Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D4F459930 for ; Fri, 23 Mar 2012 22:21:49 +0000 (UTC) Received: (qmail 91458 invoked by uid 500); 23 Mar 2012 22:21:49 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 91333 invoked by uid 500); 23 Mar 2012 22:21:49 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 91174 invoked by uid 99); 23 Mar 2012 22:21:49 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 22:21:49 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EE8B08BF5; Fri, 23 Mar 2012 22:21:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hermwong@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [4/10] webos commit: updatd to 1.5.0 Message-Id: <20120323222148.EE8B08BF5@tyr.zones.apache.org> Date: Fri, 23 Mar 2012 22:21:48 +0000 (UTC) updatd to 1.5.0 Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-webos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-webos/commit/246123e9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-webos/tree/246123e9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-webos/diff/246123e9 Branch: refs/heads/master Commit: 246123e9645915b30e89fa632a478dec3d308245 Parents: 6d2b400 Author: Steven Gill Authored: Sat Mar 3 08:31:19 2012 -0800 Committer: hermwong Committed: Fri Mar 23 15:09:35 2012 -0700 ---------------------------------------------------------------------- VERSION | 2 +- framework/phonegap-1.0.0.js | 1828 -------------------------------------- framework/phonegap-1.5.0.js | 1828 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 1829 insertions(+), 1829 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-webos/blob/246123e9/VERSION ---------------------------------------------------------------------- diff --git a/VERSION b/VERSION index 13175fd..3e1ad72 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.1 \ No newline at end of file +1.5.0 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-cordova-webos/blob/246123e9/framework/phonegap-1.0.0.js ---------------------------------------------------------------------- diff --git a/framework/phonegap-1.0.0.js b/framework/phonegap-1.0.0.js deleted file mode 100644 index 1571443..0000000 --- a/framework/phonegap-1.0.0.js +++ /dev/null @@ -1,1828 +0,0 @@ -if (typeof(DeviceInfo) != 'object') - DeviceInfo = {}; - -function PhoneGap() { - ready = true; - available = true; - sceneController = null; -}; - -PhoneGap.exec = function(win, fail, clazz, action, args) { - - setTimeout(function() { - PhoneGap.plugins[clazz].execute(action, args, win, fail); - }, 0); - -} - -PhoneGap.checkArgs = function(args, func) { - if (typeof args == 'object') - func.apply(null, args); - else - func(args); -} - -PhoneGap.callback = function(success, win, fail) { - if (success) - win(); - else - fail(); -} - -// translates the action into an API call -accelerometerAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'setFastAccelerometer': - PhoneGap.checkArgs(args, navigator.accelerometer.setFastAccelerometer); - actionFound = true; - break; - case 'getCurrentAcceleration': - PhoneGap.checkArgs(args, navigator.accelerometer.getCurrentAcceleration); - actionFound = true; - break; - case 'watchAcceleration': - PhoneGap.checkArgs(args, navigator.accelerometer.watchAcceleration); - actionFound = true; - break; - case 'clearWatch': - PhoneGap.checkArgs(args, navigator.accelerometer.clearWatch); - actionFound = true; - break; - case 'start': - PhoneGap.checkArgs(args, navigator.accelerometer.start); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -applicationAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'activate': - PhoneGap.checkArgs(args, navigator.application.activate); - actionFound = true; - break; - case 'deactivate': - PhoneGap.checkArgs(args, navigator.application.deactivate); - actionFound = true; - break; - case 'getIdentifier': - PhoneGap.checkArgs(args, navigator.application.getIdentifier); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -cameraAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'getPicture': - console.log("in here"); - PhoneGap.checkArgs(args, navigator.camera.getPicture); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -debugAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'log': - PhoneGap.checkArgs(args, window.debug.log); - actionFound = true; - break; - case 'warn': - PhoneGap.checkArgs(args, window.debug.warn); - actionFound = true; - break; - case 'error': - PhoneGap.checkArgs(args, window.debug.error); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -deviceAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'getDeviceInfo': - PhoneGap.checkArgs(args, navigator.device.getDeviceInfo); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -geolocationAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'getCurrentPosition': - PhoneGap.checkArgs(args, navigator.geolocation.getCurrentPosition); - actionFound = true; - break; - case 'watchPosition': - PhoneGap.checkArgs(args, navigator.geolocation.watchPosition); - actionFound = true; - break; - case 'clearWatch': - PhoneGap.checkArgs(args, navigator.geolocation.clearWatch); - actionFound = true; - break; - case 'start': - PhoneGap.checkArgs(args, navigator.geolocation.start); - actionFound = true; - break; - case 'stop': - PhoneGap.checkArgs(args, navigator.geolocation.stop); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -mapAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'show': - PhoneGap.checkArgs(args, navigator.map.show); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -mouseAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'simulateMouseClick': - PhoneGap.checkArgs(args, navigator.mouse.simulateMouseClick); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -networkAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'isReachable': - PhoneGap.checkArgs(args, navigator.network.isReachable); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -notificationAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'alert': - PhoneGap.checkArgs(args, navigator.notification.alert); - actionFound = true; - break; - case 'showBanner': - PhoneGap.checkArgs(args, navigator.notification.showBanner); - actionFound = true; - break; - case 'newDashboard': - PhoneGap.checkArgs(args, navigator.notification.newDashboard); - actionFound = true; - break; - case 'removeBannerMessage': - PhoneGap.checkArgs(args, navigator.notification.removeBannerMessage); - actionFound = true; - break; - case 'clearBannerMessage': - PhoneGap.checkArgs(args, navigator.notification.clearBannerMessage); - actionFound = true; - break; - case 'vibrate': - PhoneGap.checkArgs(args, navigator.notification.vibrate); - actionFound = true; - break; - case 'beep': - PhoneGap.checkArgs(args, navigator.notification.beep); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -orientationAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'setOrientation': - PhoneGap.checkArgs(args, navigator.orientation.setOrientation); - actionFound = true; - break; - case 'getOrientation': - PhoneGap.checkArgs(args, navigator.orientation.getOrientation); - actionFound = true; - break; - case 'start': - PhoneGap.checkArgs(args, navigator.orientation.start); - actionFound = true; - break; - case 'watchOrientation': - PhoneGap.checkArgs(args, navigator.orientation.watchOrientation); - actionFound = true; - break; - case 'clearWatch': - PhoneGap.checkArgs(args, navigator.orientation.clearWatch); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -smsAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'send': - PhoneGap.checkArgs(args, navigator.sms.send); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -telephonyAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'send': - PhoneGap.checkArgs(args, navigator.telephony.send); - actionFound = true; - break; - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -windowAPI = { - execute: function(action, args, win, fail) { - var actionFound = false; - switch(action) { - case 'newCard': - PhoneGap.checkArgs(args, navigator.window.newCard); - actionFound = true; - break; - case 'setFullScreen': - PhoneGap.checkArgs(args, navigator.window.setFullScreen); - actionFound = true; - break; - case 'setWindowProperties': - PhoneGap.checkArgs(args, navigator.window.setWindowProperties); - actionFound = true; - break; - case 'blockScreenTimeout': - PhoneGap.checkArgs(args, navigator.window.blockScreenTimeout); - actionFound = true; - break; - case 'setSubtleLightbar': - PhoneGap.checkArgs(args, navigator.window.setSubtleLightbar); - actionFound = true; - break; - - } - - PhoneGap.callback(actionFound, win, fail); - } -} - -// this mapping acts as a shim to the webOS APIs -PhoneGap.plugins = {}; -PhoneGap.plugins['navigator.accelerometer'] = accelerometerAPI; -PhoneGap.plugins['navigator.application'] = applicationAPI; -PhoneGap.plugins['navigator.camera'] = cameraAPI; -PhoneGap.plugins['window.debug'] = debugAPI; -PhoneGap.plugins['navigator.device'] = deviceAPI; -PhoneGap.plugins['navigator.geolocation'] = geolocationAPI; -PhoneGap.plugins['navigator.map'] = mapAPI; -PhoneGap.plugins['navigator.mouse'] = mouseAPI; -PhoneGap.plugins['navigator.network'] = networkAPI; -PhoneGap.plugins['navigator.notification'] = notificationAPI; -PhoneGap.plugins['navigator.orientation'] = orientationAPI; -PhoneGap.plugins['navigator.sms'] = smsAPI; -PhoneGap.plugins['navigator.telephony'] = telephonyAPI; -PhoneGap.plugins['navigator.window'] = windowAPI; - - -document.addEventListener('DOMContentLoaded', function () { - window.phonegap = new PhoneGap(); - navigator.device.deviceReady(); -}); -/* - * This class contains acceleration information - * @constructor - * @param {Number} x The force applied by the device in the x-axis. - * @param {Number} y The force applied by the device in the y-axis. - * @param {Number} z The force applied by the device in the z-axis. - */ -function Acceleration(x, y, z) { - /* - * The force applied by the device in the x-axis. - */ - this.x = x; - /* - * The force applied by the device in the y-axis. - */ - this.y = y; - /* - * The force applied by the device in the z-axis. - */ - this.z = z; - /* - * The time that the acceleration was obtained. - */ - this.timestamp = new Date().getTime(); -}; - -/* - * This class specifies the options for requesting acceleration data. - * @constructor - */ -function AccelerationOptions() { - /* - * The timeout after which if acceleration data cannot be obtained the errorCallback - * is called. - */ - this.timeout = 10000; -}; - -/* - * This class provides access to device accelerometer data. - * @constructor - */ -function Accelerometer() { - /* - * The last known acceleration. - */ - this.lastAcceleration = null; -}; - -/* - * Tells WebOS to put higher priority on accelerometer resolution. Also relaxes the internal garbage collection events. - * @param {Boolean} state - * Dependencies: Mojo.windowProperties - * Example: - * navigator.accelerometer.setFastAccelerometer(true) - */ -Accelerometer.prototype.setFastAccelerometer = function(state) { - navigator.windowProperties.fastAccelerometer = state; - navigator.window.setWindowProperties(); -}; - -/* - * Asynchronously aquires the current acceleration. - * @param {Function} successCallback The function to call when the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ - -Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) { - - var referenceTime = 0; - if (this.lastAcceleration) - referenceTime = this.lastAcceleration.timestamp; - else - this.start(); - - var timeout = 20000; - var interval = 500; - if (typeof(options) == 'object' && options.interval) - interval = options.interval; - - if (typeof(successCallback) != 'function') - successCallback = function() {}; - if (typeof(errorCallback) != 'function') - errorCallback = function() {}; - - var dis = this; - var delay = 0; - var timer = setInterval(function() { - delay += interval; - - //if we have a new acceleration, call success and cancel the timer - if (typeof(dis.lastAcceleration) == 'object' && dis.lastAcceleration != null && dis.lastAcceleration.timestamp > referenceTime) { - successCallback(dis.lastAcceleration); - clearInterval(timer); - } else if (delay >= timeout) { //else if timeout has occured then call error and cancel the timer - errorCallback(); - clearInterval(timer); - } - //else the interval gets called again - }, interval); -}; - - -/* - * Asynchronously aquires the acceleration repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ - -Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) { - this.getCurrentAcceleration(successCallback, errorCallback, options); - // TODO: add the interval id to a list so we can clear all watches - var frequency = (options != undefined)? options.frequency : 10000; - var that = this; - return setInterval(function() { - that.getCurrentAcceleration(successCallback, errorCallback, options); - }, frequency); -}; - -/* - * Clears the specified accelerometer watch. - * @param {String} watchId The ID of the watch returned from #watchAcceleration. - */ -Accelerometer.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -}; - -/* - * Starts the native acceleration listener. - */ - -Accelerometer.prototype.start = function() { - var that = this; - //Mojo.Event.listen(document, "acceleration", function(event) { - document.addEventListener("acceleration", function(event) { - var accel = new Acceleration(event.accelX, event.accelY, event.accelZ); - that.lastAcceleration = accel; - }); -}; - -if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer(); - -function Application() { - -}; - -/* - * Tell webOS to activate the current page of your app, bringing it into focus. - * Example: - * navigator.application.activate(); - */ -Application.prototype.activate = function() { - PalmSystem.activate(); -}; - -/* - * Tell webOS to deactivate your app. - * Example: - * navigator.application.deactivate(); - */ -Application.prototype.deactivate = function() { - PalmSystem.deactivate(); -}; - -/* - * Returns the identifier of the current running application (e.g. com.yourdomain.yourapp). - * Example: - * navigator.application.getIdentifier(); - */ -Application.prototype.getIdentifier = function() { - return PalmSystem.identifier; -}; - -if (typeof navigator.application == "undefined") navigator.application = new Application(); - -/* - * This class provides access to the device audio - * @constructor - */ - -PhoneGap.overrideAudio = function() { - - PhoneGap.MojoAudio = Audio; - - Audio = function(src) { - this.src = src; - }; - - Audio.prototype.play = function() { - // this.src = src; - // The 'end' event listener doesn't seem to work, so we have to call stop before playing - // otherwise, we'll never be able to play again - if (this.paused && !this.stopped) { - this.paused = false; - this.playing = true; - this.audioPlayer.play(); - } else { - if (this.audioPlayer) - this.stop(); - if (!this.playing) { - this.paused = false; - this.playing = true; - this.stopped = false; - this.audioPlayer = new PhoneGap.MojoAudio(); - var file = Mojo.appPath + this.src; - if (this.audioPlayer.palm) { - this.audioPlayer.mojo.audioClass = "media"; - } - this.audioPlayer.src = file; - - //event doesn't work, see above - this.audioPlayer.addEventListener('end', this.endHandler, false); - this.audioPlayer.play(); - } - } - }; - - Audio.prototype.pause = function() { - if (this.stopped) - return; - this.paused = true; - if (this.playing) { - this.playing = false; - this.stopped = false; - this.audioPlayer.pause(); - } else { - this.playing = false; - this.paused = false; - this.stopped = true; - } - }; - - Audio.prototype.stop = function() { - this.audioPlayer.pause(); - this.audioPlayer.src = null; - this.playing = false; - this.paused = false; - this.stopped = true; - }; - - // End event handler not working (see comment in Audio.prototype.play) - Audio.prototype.endHandler = function () { - this.audioPlayer.removeEventListener('end', endHandler, false); - this.audioPlayer.pause(); - this.audioPlayer.src = null; - this.paused = false; - this.stopped = true; - }; - - /* - * This class contains information about any Media errors. - * @constructor - */ - MediaError = function() { - this.code = null, - this.message = ""; - }; - - MediaError.MEDIA_ERR_ABORTED = 1; - MediaError.MEDIA_ERR_NETWORK = 2; - MediaError.MEDIA_ERR_DECODE = 3; - MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; - -} - -document.addEventListener("deviceready", PhoneGap.overrideAudio, false); - -/* - * This class provides access to the device camera. - * @constructor - */ -function Camera() { - -}; - -/* - * @param {Function} successCallback - * @param {Function} errorCallback - * @param {Object} options - */ -Camera.prototype.getPicture = function(successCallback, errorCallback, options) { - - var filename = ""; - - if (typeof options != 'undefined' && typeof options.filename != 'undefined') { - filename = options.filename; - } - - this.service = navigator.service.Request('palm://com.palm.applicationManager', { - method: 'launch', - parameters: { - id: 'com.palm.app.camera', - params: { - appId: 'com.palm.app.camera', - name: 'capture', - sublaunch: true, - filename: filename - } - }, - onSuccess: successCallback, - onFailure: errorCallback - }); -}; - -if (typeof navigator.camera == 'undefined') navigator.camera = new Camera(); - -/* - * This class provides access to the device contacts. - * @constructor - */ - -function Contacts() { - -}; - -function Contact() { - this.phones = []; - this.emails = []; - this.name = { - givenName: "", - familyName: "", - formatted: "" - }; - this.id = ""; -}; - -Contact.prototype.displayName = function() -{ - // TODO: can be tuned according to prefs - return this.givenName + " " + this.familyName; -}; - -function ContactsFilter(name) { - if (name) - this.name = name; - else - this.name = ""; -}; - -/* - * @param {ContactsFilter} filter Object with filter properties. filter.name only for now. - * @param {function} successCallback Callback function on success - * @param {function} errorCallback Callback function on failure - * @param {object} options Object with properties .page and .limit for paging - */ - -Contacts.prototype.find = function(filter, successCallback, errorCallback, options) { - errorCallback({ name: "ContactsError", message: "PhoneGap Palm contacts not implemented" }); -}; - -Contacts.prototype.success_callback = function(contacts_iterator) { -}; - -if (typeof navigator.contacts == "undefined") navigator.contacts = new Contacts(); -/* - * This class provides access to the debugging console. - * @constructor - */ -function DebugConsole() { -}; - -/* - * Print a normal log message to the console - * @param {Object|String} message Message or object to print to the console - */ -DebugConsole.prototype.log = function(message) { - if (typeof message == 'object') - message = Object.toJSON(message); - - this.error(message); -}; - -/* - * Print a warning message to the console - * @param {Object|String} message Message or object to print to the console - */ -DebugConsole.prototype.warn = function(message) { - if (typeof message == 'object') - message = Object.toJSON(message); - - this.error(message); -}; - -/** - * Print an error message to the console - * @param {Object|String} message Message or object to print to the console - */ -DebugConsole.prototype.error = function(message) { - if (typeof message == 'object') - message = Object.toJSON(message); - - console.log(JSON.stringify(message)); -}; - -if (typeof window.debug == "undefined") window.debug = new DebugConsole(); -/* - * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the - * phone, etc. - * @constructor - */ -function Device() { - this.platform = "palm"; - this.version = null; - this.name = null; - this.uuid = null; - this.deviceInfo = null; -}; - -/* - * A direct call to return device information. - * Example: - * var deviceinfo = JSON.stringify(navigator.device.getDeviceInfo()).replace(/,/g, ', '); - */ -Device.prototype.getDeviceInfo = function() { - return this.deviceInfo;//JSON.parse(PalmSystem.deviceInfo); -}; - -/* - * needs to be invoked in a