updating to latest JS for geo updates
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/f6985a30 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/f6985a30 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/f6985a30 Branch: refs/heads/master Commit: f6985a300ec378eced2179a8d44ad8599e65e641 Parents: a166a1e Author: Fil Maj <maj....@gmail.com> Authored: Mon May 7 16:37:07 2012 -0700 Committer: Fil Maj <maj....@gmail.com> Committed: Tue May 8 12:55:55 2012 -0700 ---------------------------------------------------------------------- CordovaLib/javascript/cordova.ios.js | 295 +++++++++++++++++++---------- 1 files changed, 195 insertions(+), 100 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/f6985a30/CordovaLib/javascript/cordova.ios.js ---------------------------------------------------------------------- diff --git a/CordovaLib/javascript/cordova.ios.js b/CordovaLib/javascript/cordova.ios.js index 0e98ab8..9063d6a 100644 --- a/CordovaLib/javascript/cordova.ios.js +++ b/CordovaLib/javascript/cordova.ios.js @@ -1,6 +1,6 @@ -// commit 9cfdc134f83b5d51f655e52ec7d4ddab167437c7 +// commit a5f0a62f9a9dc5fd7af95ec3d09b6b17c0b89b44 -// File generated at :: Tue May 01 2012 14:06:43 GMT-0700 (PDT) +// File generated at :: Mon May 07 2012 16:20:11 GMT-0700 (PDT) /* Licensed to the Apache Software Foundation (ASF) under one @@ -771,6 +771,9 @@ module.exports = { path: 'cordova/plugin/network' } } + }, + splashscreen: { + path: 'cordova/plugin/splashscreen' } } }, @@ -1692,15 +1695,20 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { /** * The altitude of the position. */ - this.altitude = alt; + this.altitude = (alt !== undefined ? alt : null); /** * The direction the device is moving at the position. */ - this.heading = head; + this.heading = (head !== undefined ? head : null); /** * The velocity with which the device is moving at the position. */ - this.speed = vel; + this.speed = (vel !== undefined ? vel : null); + + if (this.speed === 0 || this.speed === null) { + this.heading = NaN; + } + /** * The altitude accuracy of the position. */ @@ -1708,6 +1716,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { }; module.exports = Coordinates; + }); // file: lib/common/plugin/DirectoryEntry.js @@ -3175,15 +3184,16 @@ define("cordova/plugin/Position", function(require, exports, module) { var Coordinates = require('cordova/plugin/Coordinates'); var Position = function(coords, timestamp) { - if (coords) { - this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy); - } else { - this.coords = new Coordinates(); - } - this.timestamp = (timestamp !== undefined) ? timestamp : new Date(); + if (coords) { + this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy); + } else { + this.coords = new Coordinates(); + } + this.timestamp = (timestamp !== undefined) ? timestamp : new Date().getTime(); }; module.exports = Position; + }); // file: lib/common/plugin/PositionError.js @@ -3806,16 +3816,16 @@ var geolocation = { } else { if (options.timeout !== Infinity) { // If the timeout value was not set to Infinity (default), then - // set up a timeout function that will fire the error callback + // set up a timeout function that will fire the error callback // if no successful position was retrieved before timeout expired. timeoutTimer = createTimeout(fail, options.timeout); } else { // This is here so the check in the win function doesn't mess stuff up - // may seem weird but this guarantees timeoutTimer is + // may seem weird but this guarantees timeoutTimer is // always truthy before we call into native - timeoutTimer = true; + timeoutTimer = true; } - exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); + exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); } return timeoutTimer; }, @@ -3881,12 +3891,13 @@ var geolocation = { if (id && timers[id] !== undefined) { clearTimeout(timers[id]); delete timers[id]; - exec(null, null, "Geolocation", "clearWatch", [id]); + exec(null, null, "Geolocation", "clearWatch", [id]); } } }; module.exports = geolocation; + }); // file: lib/ios/plugin/ios/Contact.js @@ -4418,106 +4429,190 @@ module.exports = function(uri, successCallback, errorCallback) { }); +// file: lib/common/plugin/splashscreen.js +define("cordova/plugin/splashscreen", function(require, exports, module) { +var exec = require('cordova/exec'); + +var splashscreen = { + hide:function() { + exec(null, null, "SplashScreen", "hide", []); + } +}; + +module.exports = splashscreen; +}); + // file: lib/common/utils.js define("cordova/utils", function(require, exports, module) { -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 utils = exports; -var _self = { - isArray:function(a) { - return Object.prototype.toString.call(a) == '[object Array]'; - }, - isDate:function(d) { - return Object.prototype.toString.call(d) == '[object Date]'; - }, - /** - * Does a deep clone of the object. - */ - clone: function(obj) { - if(!obj || typeof obj == 'function' || _self.isDate(obj) || typeof obj != 'object') { - return obj; - } +/** + * Returns an indication of whether the argument is an array or not + */ +utils.isArray = function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; - var retVal, i; +/** + * Returns an indication of whether the argument is a Date or not + */ +utils.isDate = function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; +}; - if(_self.isArray(obj)){ - retVal = []; - for(i = 0; i < obj.length; ++i){ - retVal.push(_self.clone(obj[i])); - } - return retVal; - } +/** + * Does a deep clone of the object. + */ +utils.clone = function(obj) { + if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { + return obj; + } - retVal = {}; - for(i in obj){ - if(!(i in retVal) || retVal[i] != obj[i]) { - retVal[i] = _self.clone(obj[i]); - } + var retVal, i; + + if(utils.isArray(obj)){ + retVal = []; + for(i = 0; i < obj.length; ++i){ + retVal.push(utils.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); - }; + retVal = {}; + for(i in obj){ + if(!(i in retVal) || retVal[i] != obj[i]) { + retVal[i] = utils.clone(obj[i]); } - }, - - /** - * Create a UUID - */ - createUUID: function() { - return UUIDcreatePart(4) + '-' + - UUIDcreatePart(2) + '-' + - UUIDcreatePart(2) + '-' + - UUIDcreatePart(2) + '-' + - UUIDcreatePart(6); - }, + } + return retVal; +}; - /** - * 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; +/** + * Returns a wrappered version of the function + */ +utils.close = function(context, func, params) { + if (typeof params == 'undefined') { + return function() { + return func.apply(context, arguments); + }; + } else { + return function() { + return func.apply(context, params); }; - }()), + } +}; - /** - * Alerts a message in any available way: alert or console.log. - */ - alert:function(msg) { - if (alert) { - alert(msg); - } else if (console && console.log) { - console.log(msg); +/** + * Create a UUID + */ +utils.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. + */ +utils.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; + }; +}()); + +/** + * Alerts a message in any available way: alert or console.log. + */ +utils.alert = function(msg) { + if (alert) { + alert(msg); + } else if (console && console.log) { + console.log(msg); + } +}; + +/** + * Formats a string and arguments following it ala sprintf() + * + * format chars: + * %j - format arg as JSON + * %o - format arg as JSON + * %c - format arg as '' + * %% - replace with '%' + * any other char following % will format it's + * arg via toString(). + * + * for rationale, see FireBug's Console API: + * http://getfirebug.com/wiki/index.php/Console_API + */ +utils.format = function(formatString /* ,... */) { + if (formatString === null || formatString === undefined) return ""; + if (arguments.length == 1) return formatString.toString(); + + var pattern = /(.*?)%(.)(.*)/; + var rest = formatString.toString(); + var result = []; + var args = [].slice.call(arguments,1); + + while (args.length) { + var arg = args.shift(); + var match = pattern.exec(rest); + + if (!match) break; + + rest = match[3]; + + result.push(match[1]); + + if (match[2] == '%') { + result.push('%'); + args.unshift(arg); + continue; } + + result.push(formatted(arg, match[2])); } + + result.push(rest); + + return result.join(''); }; -module.exports = _self; +//------------------------------------------------------------------------------ +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; +} + +//------------------------------------------------------------------------------ +function formatted(object, formatChar) { + + switch(formatChar) { + case 'j': + case 'o': return JSON.stringify(object); + case 'c': return ''; + } + + if (null === object) return Object.prototype.toString.call(object); + + return object.toString(); +} }); @@ -4578,4 +4673,4 @@ window.cordova = require('cordova'); }(window)); -})(); +})(); \ No newline at end of file