incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deedu...@apache.org
Subject webworks commit: Update javascript to 1.6.0 version.
Date Tue, 10 Apr 2012 20:36:54 GMT
Updated Branches:
  refs/heads/master 237104477 -> ea7b8f8ba


Update javascript to 1.6.0 version.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/ea7b8f8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/ea7b8f8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/ea7b8f8b

Branch: refs/heads/master
Commit: ea7b8f8ba6c875dd8e690691a0386b1918ba4882
Parents: 2371044
Author: Drew Walters <deedubbu@apache.org>
Authored: Tue Apr 10 15:36:30 2012 -0500
Committer: Drew Walters <deedubbu@apache.org>
Committed: Tue Apr 10 15:36:30 2012 -0500

----------------------------------------------------------------------
 javascript/cordova.blackberry.js |  269 +++++++++++++++++++++-----------
 javascript/cordova.playbook.js   |  255 +++++++++++++++++++++-----------
 2 files changed, 345 insertions(+), 179 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/ea7b8f8b/javascript/cordova.blackberry.js
----------------------------------------------------------------------
diff --git a/javascript/cordova.blackberry.js b/javascript/cordova.blackberry.js
index b183c79..801b37f 100644
--- a/javascript/cordova.blackberry.js
+++ b/javascript/cordova.blackberry.js
@@ -1,3 +1,5 @@
+// File generated at :: Tue Apr 10 2012 15:32:24 GMT-0500 (CDT)
+
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -143,6 +145,13 @@ function createEvent(type, data) {
   return event;
 }
 
+if(typeof window.console === "undefined")
+{
+	window.console = { 
+		log:function(){}
+	};
+}
+
 var cordova = {
     define:define,
     require:require,
@@ -162,6 +171,15 @@ var cordova = {
       delete documentEventHandlers[event];
     },
     /**
+     * Retreive original event handlers that were replaced by Cordova
+     *
+     * @return object
+     */
+    getOriginalHandlers: function() {
+        return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener},
+        'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}};
+    },
+    /**
      * Method to fire event from native code
      */
     fireDocumentEvent: function(type, data) {
@@ -302,7 +320,7 @@ if (!window.plugins) {
 
 module.exports = cordova;
 
-})
+});
 
 // file: lib/common/builder.js
 define("cordova/builder", function(require, exports, module) {
@@ -393,12 +411,45 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/channel.js
 define("cordova/channel", function(require, exports, module) {
 /**
- * Custom pub-sub channel that can have functions subscribed to it
+ * Custom pub-sub "channel" that can have functions subscribed to it
+ * This object is used to define and control firing of events for
+ * cordova initialization.
+ *
+ * The order of events during page load and Cordova startup is as follows:
+ *
+ * onDOMContentLoaded         Internal event that is received when the web page is loaded and parsed.
+ * onNativeReady              Internal event that indicates the Cordova native side is ready.
+ * onCordovaReady             Internal event fired when all Cordova JavaScript objects have been created.
+ * onCordovaInfoReady         Internal event fired when device properties are available.
+ * onCordovaConnectionReady   Internal event fired when the connection property has been set.
+ * onDeviceReady              User event fired to indicate that Cordova is ready
+ * onResume                   User event fired to indicate a start/resume lifecycle event
+ * onPause                    User event fired to indicate a pause lifecycle event
+ * onDestroy                  Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
+ *
+ * The only Cordova events that user code should register for are:
+ *      deviceready           Cordova native code is initialized and Cordova APIs can be called from JavaScript
+ *      pause                 App has moved to background
+ *      resume                App has returned to foreground
+ *
+ * Listeners can be registered as:
+ *      document.addEventListener("deviceready", myDeviceReadyListener, false);
+ *      document.addEventListener("resume", myResumeListener, false);
+ *      document.addEventListener("pause", myPauseListener, false);
+ *
+ * The DOM lifecycle events should be used for saving and restoring state
+ *      window.onload
+ *      window.onunload
+ *
+ */
+
+/**
+ * Channel
  * @constructor
  * @param type  String the channel name
  * @param opts  Object options to pass into the channel, currently
@@ -568,8 +619,7 @@ Channel.prototype.fire = function(e) {
     return true;
 };
 
-//HACK: defining them here so they are ready super fast!
-
+// defining them here so they are ready super fast!
 // DOM event that is received when the web page is loaded and parsed.
 channel.create('onDOMContentLoaded');
 
@@ -605,7 +655,7 @@ channel.waitForInitialization('onCordovaConnectionReady');
 
 module.exports = channel;
 
-})
+});
 
 // file: lib/common/common.js
 define("cordova/common", function(require, exports, module) {
@@ -790,7 +840,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/blackberry/exec.js
 define("cordova/exec", function(require, exports, module) {
@@ -852,7 +902,7 @@ module.exports = function(success, fail, service, action, args) {
     }
 };
 
-})
+});
 
 // file: lib/blackberry/platform.js
 define("cordova/platform", function(require, exports, module) {
@@ -1036,20 +1086,20 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/plugin/Acceleration.js
 define("cordova/plugin/Acceleration", function(require, exports, module) {
-var Acceleration = function(x, y, z) {
+var Acceleration = function(x, y, z, timestamp) {
   this.x = x;
   this.y = y;
   this.z = z;
-  this.timestamp = new Date().getTime();
+  this.timestamp = timestamp || (new Date()).getTime();
 };
 
 module.exports = Acceleration;
 
-})
+});
 
 // file: lib/common/plugin/Camera.js
 define("cordova/plugin/Camera", function(require, exports, module) {
@@ -1130,15 +1180,36 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
     if (typeof options.encodingType == "number") {
         encodingType = options.encodingType;
     }
-    // TODO: parse MediaType
-    // TODO: enable allow edit?
+    
+    var mediaType = Camera.MediaType.PICTURE;
+    if (typeof options.mediaType == "number") {
+        mediaType = options.mediaType;
+    }
+    var allowEdit = false;
+    if (typeof options.allowEdit == "boolean") {
+    	allowEdit = options.allowEdit;
+    } else if (typeof options.allowEdit == "number") {
+    	allowEdit = options.allowEdit <= 0 ? false : true;
+    }
+    var correctOrientation = false;
+    if (typeof options.correctOrientation == "boolean") {
+    	correctOrientation = options.correctOrientation;
+    } else if (typeof options.correctOrientation == "number") {
+    	correctOrientation = options.correctOrientation <=0 ? false : true;
+    }
+    var saveToPhotoAlbum = false;
+	if (typeof options.saveToPhotoAlbum == "boolean") {
+    	saveToPhotoAlbum = options.saveToPhotoAlbum;
+    } else if (typeof options.saveToPhotoAlbum == "number") {
+    	saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true;
+    }
 
-    exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType]);
+    exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, mediaType, allowEdit, correctOrientation, saveToPhotoAlbum]);
 }
 
 module.exports = cameraExport;
 
-})
+});
 
 // file: lib/common/plugin/CameraConstants.js
 define("cordova/plugin/CameraConstants", function(require, exports, module) {
@@ -1163,7 +1234,7 @@ module.exports = {
   }
 };
 
-})
+});
 
 // file: lib/common/plugin/CaptureAudioOptions.js
 define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) {
@@ -1181,7 +1252,7 @@ var CaptureAudioOptions = function(){
 
 module.exports = CaptureAudioOptions;
 
-})
+});
 
 // file: lib/common/plugin/CaptureError.js
 define("cordova/plugin/CaptureError", function(require, exports, module) {
@@ -1205,7 +1276,7 @@ CaptureError.CAPTURE_NOT_SUPPORTED = 20;
 
 module.exports = CaptureError;
 
-})
+});
 
 // file: lib/common/plugin/CaptureImageOptions.js
 define("cordova/plugin/CaptureImageOptions", function(require, exports, module) {
@@ -1221,7 +1292,7 @@ var CaptureImageOptions = function(){
 
 module.exports = CaptureImageOptions;
 
-})
+});
 
 // file: lib/common/plugin/CaptureVideoOptions.js
 define("cordova/plugin/CaptureVideoOptions", function(require, exports, module) {
@@ -1239,7 +1310,7 @@ var CaptureVideoOptions = function(){
 
 module.exports = CaptureVideoOptions;
 
-})
+});
 
 // file: lib/common/plugin/CompassError.js
 define("cordova/plugin/CompassError", function(require, exports, module) {
@@ -1257,7 +1328,7 @@ CompassError.COMPASS_NOT_SUPPORTED = 20;
 
 module.exports = CompassError;
 
-})
+});
 
 // file: lib/common/plugin/CompassHeading.js
 define("cordova/plugin/CompassHeading", function(require, exports, module) {
@@ -1265,12 +1336,12 @@ var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, tim
   this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null);
   this.trueHeading = (trueHeading !== undefined ? trueHeading : null);
   this.headingAccuracy = (headingAccuracy !== undefined ? headingAccuracy : null);
-  this.timestamp = (timestamp !== undefined ? new Date(timestamp) : new Date());
+  this.timestamp = (timestamp !== undefined ? timestamp : new Date().getTime());
 };
 
 module.exports = CompassHeading;
 
-})
+});
 
 // file: lib/common/plugin/ConfigurationData.js
 define("cordova/plugin/ConfigurationData", function(require, exports, module) {
@@ -1290,7 +1361,7 @@ function ConfigurationData() {
 
 module.exports = ConfigurationData;
 
-})
+});
 
 // file: lib/common/plugin/Connection.js
 define("cordova/plugin/Connection", function(require, exports, module) {
@@ -1307,7 +1378,7 @@ module.exports = {
 		NONE: "none"
 };
 
-})
+});
 
 // file: lib/common/plugin/Contact.js
 define("cordova/plugin/Contact", function(require, exports, module) {
@@ -1489,7 +1560,7 @@ Contact.prototype.save = function(successCB, errorCB) {
 
 module.exports = Contact;
 
-})
+});
 
 // file: lib/common/plugin/ContactAddress.js
 define("cordova/plugin/ContactAddress", function(require, exports, module) {
@@ -1519,7 +1590,7 @@ var ContactAddress = function(pref, type, formatted, streetAddress, locality, re
 
 module.exports = ContactAddress;
 
-})
+});
 
 // file: lib/common/plugin/ContactError.js
 define("cordova/plugin/ContactError", function(require, exports, module) {
@@ -1545,7 +1616,7 @@ ContactError.PERMISSION_DENIED_ERROR = 20;
 
 module.exports = ContactError;
 
-})
+});
 
 // file: lib/common/plugin/ContactField.js
 define("cordova/plugin/ContactField", function(require, exports, module) {
@@ -1566,7 +1637,7 @@ var ContactField = function(type, value, pref) {
 
 module.exports = ContactField;
 
-})
+});
 
 // file: lib/common/plugin/ContactFindOptions.js
 define("cordova/plugin/ContactFindOptions", function(require, exports, module) {
@@ -1584,7 +1655,7 @@ var ContactFindOptions = function(filter, multiple) {
 
 module.exports = ContactFindOptions;
 
-})
+});
 
 // file: lib/common/plugin/ContactName.js
 define("cordova/plugin/ContactName", function(require, exports, module) {
@@ -1609,7 +1680,7 @@ var ContactName = function(formatted, familyName, givenName, middle, prefix, suf
 
 module.exports = ContactName;
 
-})
+});
 
 // file: lib/common/plugin/ContactOrganization.js
 define("cordova/plugin/ContactOrganization", function(require, exports, module) {
@@ -1637,7 +1708,7 @@ var ContactOrganization = function(pref, type, name, dept, title) {
 
 module.exports = ContactOrganization;
 
-})
+});
 
 // file: lib/common/plugin/Coordinates.js
 define("cordova/plugin/Coordinates", function(require, exports, module) {
@@ -1685,7 +1756,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
 
 module.exports = Coordinates;
 
-})
+});
 
 // file: lib/common/plugin/DirectoryEntry.js
 define("cordova/plugin/DirectoryEntry", function(require, exports, module) {
@@ -1770,7 +1841,7 @@ DirectoryEntry.prototype.getFile = function(path, options, successCallback, erro
 
 module.exports = DirectoryEntry;
 
-})
+});
 
 // file: lib/common/plugin/DirectoryReader.js
 define("cordova/plugin/DirectoryReader", function(require, exports, module) {
@@ -1816,7 +1887,7 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
 
 module.exports = DirectoryReader;
 
-})
+});
 
 // file: lib/common/plugin/Entry.js
 define("cordova/plugin/Entry", function(require, exports, module) {
@@ -2024,7 +2095,7 @@ Entry.prototype.getParent = function(successCallback, errorCallback) {
 
 module.exports = Entry;
 
-})
+});
 
 // file: lib/common/plugin/File.js
 define("cordova/plugin/File", function(require, exports, module) {
@@ -2047,7 +2118,7 @@ var File = function(name, fullPath, type, lastModifiedDate, size){
 
 module.exports = File;
 
-})
+});
 
 // file: lib/common/plugin/FileEntry.js
 define("cordova/plugin/FileEntry", function(require, exports, module) {
@@ -2115,7 +2186,7 @@ FileEntry.prototype.file = function(successCallback, errorCallback) {
 
 module.exports = FileEntry;
 
-})
+});
 
 // file: lib/common/plugin/FileError.js
 define("cordova/plugin/FileError", function(require, exports, module) {
@@ -2145,7 +2216,7 @@ FileError.PATH_EXISTS_ERR = 12;
 
 module.exports = FileError;
 
-})
+});
 
 // file: lib/common/plugin/FileReader.js
 define("cordova/plugin/FileReader", function(require, exports, module) {
@@ -2399,7 +2470,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) {
 
 module.exports = FileReader;
 
-})
+});
 
 // file: lib/common/plugin/FileSystem.js
 define("cordova/plugin/FileSystem", function(require, exports, module) {
@@ -2421,7 +2492,7 @@ var FileSystem = function(name, root) {
 
 module.exports = FileSystem;
 
-})
+});
 
 // file: lib/common/plugin/FileTransfer.js
 define("cordova/plugin/FileTransfer", function(require, exports, module) {
@@ -2441,8 +2512,9 @@ var FileTransfer = function() {};
 * @param successCallback (Function}  Callback to be invoked when upload has completed
 * @param errorCallback {Function}    Callback to be invoked upon error
 * @param options {FileUploadOptions} Optional parameters such as file name and mimetype
+* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
 */
-FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, debug) {
+FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) {
     // check for options
     var fileKey = null;
     var fileName = null;
@@ -2464,7 +2536,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
         }
     }
 
-    exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, debug, chunkedMode]);
+    exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode]);
 };
 
 /**
@@ -2494,7 +2566,7 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
 
 module.exports = FileTransfer;
 
-})
+});
 
 // file: lib/common/plugin/FileTransferError.js
 define("cordova/plugin/FileTransferError", function(require, exports, module) {
@@ -2512,7 +2584,7 @@ FileTransferError.CONNECTION_ERR = 3;
 
 module.exports = FileTransferError;
 
-})
+});
 
 // file: lib/common/plugin/FileUploadOptions.js
 define("cordova/plugin/FileUploadOptions", function(require, exports, module) {
@@ -2533,7 +2605,7 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
 
 module.exports = FileUploadOptions;
 
-})
+});
 
 // file: lib/common/plugin/FileUploadResult.js
 define("cordova/plugin/FileUploadResult", function(require, exports, module) {
@@ -2549,7 +2621,7 @@ var FileUploadResult = function() {
 
 module.exports = FileUploadResult;
 
-})
+});
 
 // file: lib/common/plugin/FileWriter.js
 define("cordova/plugin/FileWriter", function(require, exports, module) {
@@ -2713,7 +2785,7 @@ FileWriter.prototype.seek = function(offset) {
         throw new FileError(FileError.INVALID_STATE_ERR);
     }
 
-    if (!offset) {
+    if (!offset && offset != 0) {
         return;
     }
 
@@ -2807,7 +2879,7 @@ FileWriter.prototype.truncate = function(size) {
 
 module.exports = FileWriter;
 
-})
+});
 
 // file: lib/common/plugin/Flags.js
 define("cordova/plugin/Flags", function(require, exports, module) {
@@ -2827,7 +2899,7 @@ function Flags(create, exclusive) {
 
 module.exports = Flags;
 
-})
+});
 
 // file: lib/common/plugin/LocalFileSystem.js
 define("cordova/plugin/LocalFileSystem", function(require, exports, module) {
@@ -2845,7 +2917,7 @@ LocalFileSystem.PERSISTENT = 1; //persistent
 
 module.exports = LocalFileSystem;
 
-})
+});
 
 // file: lib/common/plugin/Media.js
 define("cordova/plugin/Media", function(require, exports, module) {
@@ -3037,7 +3109,7 @@ Media.onStatus = function(id, msg, value) {
 
 module.exports = Media;
 
-})
+});
 
 // file: lib/common/plugin/MediaError.js
 define("cordova/plugin/MediaError", function(require, exports, module) {
@@ -3058,7 +3130,7 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
 
 module.exports = MediaError;
 
-})
+});
 
 // file: lib/common/plugin/MediaFile.js
 define("cordova/plugin/MediaFile", function(require, exports, module) {
@@ -3119,7 +3191,7 @@ MediaFile.cast = function(pluginResult) {
 
 module.exports = MediaFile;
 
-})
+});
 
 // file: lib/common/plugin/MediaFileData.js
 define("cordova/plugin/MediaFileData", function(require, exports, module) {
@@ -3142,7 +3214,7 @@ var MediaFileData = function(codecs, bitrate, height, width, duration){
 
 module.exports = MediaFileData;
 
-})
+});
 
 // file: lib/common/plugin/Metadata.js
 define("cordova/plugin/Metadata", function(require, exports, module) {
@@ -3157,7 +3229,7 @@ var Metadata = function(time) {
 
 module.exports = Metadata;
 
-})
+});
 
 // file: lib/common/plugin/Position.js
 define("cordova/plugin/Position", function(require, exports, module) {
@@ -3170,7 +3242,7 @@ var Position = function(coords, timestamp) {
 
 module.exports = Position;
 
-})
+});
 
 // file: lib/common/plugin/PositionError.js
 define("cordova/plugin/PositionError", function(require, exports, module) {
@@ -3192,7 +3264,7 @@ PositionError.TIMEOUT = 3;
 
 module.exports = PositionError;
 
-})
+});
 
 // file: lib/common/plugin/ProgressEvent.js
 define("cordova/plugin/ProgressEvent", function(require, exports, module) {
@@ -3243,7 +3315,7 @@ var ProgressEvent = (function() {
 
 module.exports = ProgressEvent;
 
-})
+});
 
 // file: lib/common/plugin/accelerometer.js
 define("cordova/plugin/accelerometer", function(require, exports, module) {
@@ -3343,7 +3415,7 @@ var accelerometer = {
 
 module.exports = accelerometer;
 
-})
+});
 
 // file: lib/common/plugin/battery.js
 define("cordova/plugin/battery", function(require, exports, module) {
@@ -3435,7 +3507,7 @@ var battery = new Battery();
 
 module.exports = battery;
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/Contact.js
 define("cordova/plugin/blackberry/Contact", function(require, exports, module) {
@@ -3825,7 +3897,7 @@ module.exports = {
         }
     }
 };
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/ContactUtils.js
 define("cordova/plugin/blackberry/ContactUtils", function(require, exports, module) {
@@ -4182,7 +4254,7 @@ module.exports = {
         return contact;
     }
 };
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/DirectoryEntry.js
 define("cordova/plugin/blackberry/DirectoryEntry", function(require, exports, module) {
@@ -4426,7 +4498,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/Entry.js
 define("cordova/plugin/blackberry/Entry", function(require, exports, module) {
@@ -4518,7 +4590,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/app.js
 define("cordova/plugin/blackberry/app", function(require, exports, module) {
@@ -4574,7 +4646,7 @@ module.exports = {
   }
 };
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/contacts.js
 define("cordova/plugin/blackberry/contacts", function(require, exports, module) {
@@ -4641,7 +4713,7 @@ module.exports = {
 
 };
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/device.js
 define("cordova/plugin/blackberry/device", function(require, exports, module) {
@@ -4669,7 +4741,7 @@ channel.onCordovaReady.subscribeOnce(function() {
 
 module.exports = me;
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/manager.js
 define("cordova/plugin/blackberry/manager", function(require, exports, module) {
@@ -4761,7 +4833,7 @@ module.exports = {
     destroy: org.apache.cordova.JavaPluginManager.destroy
 };
 
-})
+});
 
 // file: lib/blackberry/plugin/blackberry/notification.js
 define("cordova/plugin/blackberry/notification", function(require, exports, module) {
@@ -4818,7 +4890,7 @@ module.exports = {
         exec(null, null, 'Notification', 'progressValue', [ value ]);
     },
 };
-})
+});
 
 // file: lib/common/plugin/capture.js
 define("cordova/plugin/capture", function(require, exports, module) {
@@ -4895,7 +4967,7 @@ Capture.prototype.captureVideo = function(successCallback, errorCallback, option
 
 module.exports = new Capture();
 
-})
+});
 
 // file: lib/common/plugin/compass.js
 define("cordova/plugin/compass", function(require, exports, module) {
@@ -4913,7 +4985,7 @@ var exec = require('cordova/exec'),
          * getting the heading data.
          * @param {CompassOptions} options The options for getting the heading data (not used).
          */
-        getCurrentHeading:function(successCallback, errorCallback) {
+        getCurrentHeading:function(successCallback, errorCallback, options) {
             // successCallback required
             if (typeof successCallback !== "function") {
               console.log("Compass Error: successCallback is not a function");
@@ -4936,7 +5008,7 @@ var exec = require('cordova/exec'),
             }
             
             // Get heading
-            exec(win, fail, "Compass", "getHeading", []);
+            exec(win, fail, "Compass", "getHeading", [options]);
         },
 
         /**
@@ -4946,11 +5018,13 @@ var exec = require('cordova/exec'),
          * @param {Function} errorCallback The function to call when there is an error 
          * getting the heading data.
          * @param {HeadingOptions} options The options for getting the heading data
-         * such as timeout and the frequency of the watch.
+         * such as timeout and the frequency of the watch. For iOS, filter parameter
+         * specifies to watch via a distance filter rather than time.
          */
         watchHeading:function(successCallback, errorCallback, options) {
             // Default interval (100 msec)
             var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
+            var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
 
             // successCallback required
             if (typeof successCallback !== "function") {
@@ -4964,13 +5038,18 @@ var exec = require('cordova/exec'),
               return;
             }
 
-            // Start watch timer to get headings
             var id = utils.createUUID();
-
-            timers[id] = window.setInterval(function() {
-                compass.getCurrentHeading(successCallback, errorCallback);
-            }, frequency);
-
+			if (filter > 0) {
+				// is an iOS request for watch by filter, no timer needed
+				timers[id] = "iOS";
+				compass.getCurrentHeading(successCallback, errorCallback, options);
+			} else {
+				// Start watch timer to get headings
+            	timers[id] = window.setInterval(function() {
+                	compass.getCurrentHeading(successCallback, errorCallback);
+            	}, frequency);
+			}
+				
             return id;
         },
 
@@ -4981,16 +5060,20 @@ var exec = require('cordova/exec'),
         clearWatch:function(id) {
             // Stop javascript timer & remove from timer list
             if (id && timers[id]) {
-              clearInterval(timers[id]);
-              delete timers[id];
+            	if (timers[id] != "iOS") {
+              		clearInterval(timers[id]);
+              	} else {
+            		// is iOS watch by filter so call into device to stop
+            		exec(null, null, "Compass", "stopHeading", []);
+            	}
+	            delete timers[id];
             }
         }
-        // TODO: add the filter-based iOS-only methods
     };
 
 module.exports = compass;
 
-})
+});
 
 // file: lib/common/plugin/contacts.js
 define("cordova/plugin/contacts", function(require, exports, module) {
@@ -5052,7 +5135,7 @@ var contacts = {
 
 module.exports = contacts;
 
-})
+});
 
 // file: lib/common/plugin/geolocation.js
 define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -5151,7 +5234,7 @@ var geolocation = {
 
 module.exports = geolocation;
 
-})
+});
 
 // file: lib/common/plugin/network.js
 define("cordova/plugin/network", function(require, exports, module) {
@@ -5216,7 +5299,7 @@ NetworkConnection.prototype.getInfo = function (successCallback, errorCallback)
 
 module.exports = new NetworkConnection();
 
-})
+});
 
 // file: lib/common/plugin/notification.js
 define("cordova/plugin/notification", function(require, exports, module) {
@@ -5277,7 +5360,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/plugin/requestFileSystem.js
 define("cordova/plugin/requestFileSystem", function(require, exports, module) {
@@ -5322,7 +5405,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
 
 module.exports = requestFileSystem;
 
-})
+});
 
 // file: lib/common/plugin/resolveLocalFileSystemURI.js
 define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) {
@@ -5368,7 +5451,7 @@ module.exports = function(uri, successCallback, errorCallback) {
     exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
 };
 
-})
+});
 
 // file: lib/webworks/plugin/webworks/manager.js
 define("cordova/plugin/webworks/manager", function(require, exports, module) {
@@ -5387,7 +5470,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/utils.js
 define("cordova/utils", function(require, exports, module) {
@@ -5496,7 +5579,7 @@ var _self = {
 
 module.exports = _self;
 
-})
+});
 
 
 window.cordova = require('cordova');

http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/ea7b8f8b/javascript/cordova.playbook.js
----------------------------------------------------------------------
diff --git a/javascript/cordova.playbook.js b/javascript/cordova.playbook.js
index 222a18e..29cba6b 100644
--- a/javascript/cordova.playbook.js
+++ b/javascript/cordova.playbook.js
@@ -1,3 +1,5 @@
+// File generated at :: Tue Apr 10 2012 15:32:25 GMT-0500 (CDT)
+
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -143,6 +145,13 @@ function createEvent(type, data) {
   return event;
 }
 
+if(typeof window.console === "undefined")
+{
+	window.console = { 
+		log:function(){}
+	};
+}
+
 var cordova = {
     define:define,
     require:require,
@@ -162,6 +171,15 @@ var cordova = {
       delete documentEventHandlers[event];
     },
     /**
+     * Retreive original event handlers that were replaced by Cordova
+     *
+     * @return object
+     */
+    getOriginalHandlers: function() {
+        return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener},
+        'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}};
+    },
+    /**
      * Method to fire event from native code
      */
     fireDocumentEvent: function(type, data) {
@@ -302,7 +320,7 @@ if (!window.plugins) {
 
 module.exports = cordova;
 
-})
+});
 
 // file: lib/common/builder.js
 define("cordova/builder", function(require, exports, module) {
@@ -393,12 +411,45 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/channel.js
 define("cordova/channel", function(require, exports, module) {
 /**
- * Custom pub-sub channel that can have functions subscribed to it
+ * Custom pub-sub "channel" that can have functions subscribed to it
+ * This object is used to define and control firing of events for
+ * cordova initialization.
+ *
+ * The order of events during page load and Cordova startup is as follows:
+ *
+ * onDOMContentLoaded         Internal event that is received when the web page is loaded and parsed.
+ * onNativeReady              Internal event that indicates the Cordova native side is ready.
+ * onCordovaReady             Internal event fired when all Cordova JavaScript objects have been created.
+ * onCordovaInfoReady         Internal event fired when device properties are available.
+ * onCordovaConnectionReady   Internal event fired when the connection property has been set.
+ * onDeviceReady              User event fired to indicate that Cordova is ready
+ * onResume                   User event fired to indicate a start/resume lifecycle event
+ * onPause                    User event fired to indicate a pause lifecycle event
+ * onDestroy                  Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
+ *
+ * The only Cordova events that user code should register for are:
+ *      deviceready           Cordova native code is initialized and Cordova APIs can be called from JavaScript
+ *      pause                 App has moved to background
+ *      resume                App has returned to foreground
+ *
+ * Listeners can be registered as:
+ *      document.addEventListener("deviceready", myDeviceReadyListener, false);
+ *      document.addEventListener("resume", myResumeListener, false);
+ *      document.addEventListener("pause", myPauseListener, false);
+ *
+ * The DOM lifecycle events should be used for saving and restoring state
+ *      window.onload
+ *      window.onunload
+ *
+ */
+
+/**
+ * Channel
  * @constructor
  * @param type  String the channel name
  * @param opts  Object options to pass into the channel, currently
@@ -568,8 +619,7 @@ Channel.prototype.fire = function(e) {
     return true;
 };
 
-//HACK: defining them here so they are ready super fast!
-
+// defining them here so they are ready super fast!
 // DOM event that is received when the web page is loaded and parsed.
 channel.create('onDOMContentLoaded');
 
@@ -605,7 +655,7 @@ channel.waitForInitialization('onCordovaConnectionReady');
 
 module.exports = channel;
 
-})
+});
 
 // file: lib/common/common.js
 define("cordova/common", function(require, exports, module) {
@@ -790,7 +840,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/playbook/exec.js
 define("cordova/exec", function(require, exports, module) {
@@ -853,7 +903,7 @@ module.exports = function(success, fail, service, action, args) {
     }
 };
 
-})
+});
 
 // file: lib/playbook/platform.js
 define("cordova/platform", function(require, exports, module) {
@@ -876,20 +926,20 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/plugin/Acceleration.js
 define("cordova/plugin/Acceleration", function(require, exports, module) {
-var Acceleration = function(x, y, z) {
+var Acceleration = function(x, y, z, timestamp) {
   this.x = x;
   this.y = y;
   this.z = z;
-  this.timestamp = new Date().getTime();
+  this.timestamp = timestamp || (new Date()).getTime();
 };
 
 module.exports = Acceleration;
 
-})
+});
 
 // file: lib/common/plugin/Camera.js
 define("cordova/plugin/Camera", function(require, exports, module) {
@@ -970,15 +1020,36 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
     if (typeof options.encodingType == "number") {
         encodingType = options.encodingType;
     }
-    // TODO: parse MediaType
-    // TODO: enable allow edit?
+    
+    var mediaType = Camera.MediaType.PICTURE;
+    if (typeof options.mediaType == "number") {
+        mediaType = options.mediaType;
+    }
+    var allowEdit = false;
+    if (typeof options.allowEdit == "boolean") {
+    	allowEdit = options.allowEdit;
+    } else if (typeof options.allowEdit == "number") {
+    	allowEdit = options.allowEdit <= 0 ? false : true;
+    }
+    var correctOrientation = false;
+    if (typeof options.correctOrientation == "boolean") {
+    	correctOrientation = options.correctOrientation;
+    } else if (typeof options.correctOrientation == "number") {
+    	correctOrientation = options.correctOrientation <=0 ? false : true;
+    }
+    var saveToPhotoAlbum = false;
+	if (typeof options.saveToPhotoAlbum == "boolean") {
+    	saveToPhotoAlbum = options.saveToPhotoAlbum;
+    } else if (typeof options.saveToPhotoAlbum == "number") {
+    	saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true;
+    }
 
-    exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType]);
+    exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, mediaType, allowEdit, correctOrientation, saveToPhotoAlbum]);
 }
 
 module.exports = cameraExport;
 
-})
+});
 
 // file: lib/common/plugin/CameraConstants.js
 define("cordova/plugin/CameraConstants", function(require, exports, module) {
@@ -1003,7 +1074,7 @@ module.exports = {
   }
 };
 
-})
+});
 
 // file: lib/common/plugin/CaptureAudioOptions.js
 define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) {
@@ -1021,7 +1092,7 @@ var CaptureAudioOptions = function(){
 
 module.exports = CaptureAudioOptions;
 
-})
+});
 
 // file: lib/common/plugin/CaptureError.js
 define("cordova/plugin/CaptureError", function(require, exports, module) {
@@ -1045,7 +1116,7 @@ CaptureError.CAPTURE_NOT_SUPPORTED = 20;
 
 module.exports = CaptureError;
 
-})
+});
 
 // file: lib/common/plugin/CaptureImageOptions.js
 define("cordova/plugin/CaptureImageOptions", function(require, exports, module) {
@@ -1061,7 +1132,7 @@ var CaptureImageOptions = function(){
 
 module.exports = CaptureImageOptions;
 
-})
+});
 
 // file: lib/common/plugin/CaptureVideoOptions.js
 define("cordova/plugin/CaptureVideoOptions", function(require, exports, module) {
@@ -1079,7 +1150,7 @@ var CaptureVideoOptions = function(){
 
 module.exports = CaptureVideoOptions;
 
-})
+});
 
 // file: lib/common/plugin/CompassError.js
 define("cordova/plugin/CompassError", function(require, exports, module) {
@@ -1097,7 +1168,7 @@ CompassError.COMPASS_NOT_SUPPORTED = 20;
 
 module.exports = CompassError;
 
-})
+});
 
 // file: lib/common/plugin/CompassHeading.js
 define("cordova/plugin/CompassHeading", function(require, exports, module) {
@@ -1105,12 +1176,12 @@ var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, tim
   this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null);
   this.trueHeading = (trueHeading !== undefined ? trueHeading : null);
   this.headingAccuracy = (headingAccuracy !== undefined ? headingAccuracy : null);
-  this.timestamp = (timestamp !== undefined ? new Date(timestamp) : new Date());
+  this.timestamp = (timestamp !== undefined ? timestamp : new Date().getTime());
 };
 
 module.exports = CompassHeading;
 
-})
+});
 
 // file: lib/common/plugin/ConfigurationData.js
 define("cordova/plugin/ConfigurationData", function(require, exports, module) {
@@ -1130,7 +1201,7 @@ function ConfigurationData() {
 
 module.exports = ConfigurationData;
 
-})
+});
 
 // file: lib/common/plugin/Connection.js
 define("cordova/plugin/Connection", function(require, exports, module) {
@@ -1147,7 +1218,7 @@ module.exports = {
 		NONE: "none"
 };
 
-})
+});
 
 // file: lib/common/plugin/Contact.js
 define("cordova/plugin/Contact", function(require, exports, module) {
@@ -1329,7 +1400,7 @@ Contact.prototype.save = function(successCB, errorCB) {
 
 module.exports = Contact;
 
-})
+});
 
 // file: lib/common/plugin/ContactAddress.js
 define("cordova/plugin/ContactAddress", function(require, exports, module) {
@@ -1359,7 +1430,7 @@ var ContactAddress = function(pref, type, formatted, streetAddress, locality, re
 
 module.exports = ContactAddress;
 
-})
+});
 
 // file: lib/common/plugin/ContactError.js
 define("cordova/plugin/ContactError", function(require, exports, module) {
@@ -1385,7 +1456,7 @@ ContactError.PERMISSION_DENIED_ERROR = 20;
 
 module.exports = ContactError;
 
-})
+});
 
 // file: lib/common/plugin/ContactField.js
 define("cordova/plugin/ContactField", function(require, exports, module) {
@@ -1406,7 +1477,7 @@ var ContactField = function(type, value, pref) {
 
 module.exports = ContactField;
 
-})
+});
 
 // file: lib/common/plugin/ContactFindOptions.js
 define("cordova/plugin/ContactFindOptions", function(require, exports, module) {
@@ -1424,7 +1495,7 @@ var ContactFindOptions = function(filter, multiple) {
 
 module.exports = ContactFindOptions;
 
-})
+});
 
 // file: lib/common/plugin/ContactName.js
 define("cordova/plugin/ContactName", function(require, exports, module) {
@@ -1449,7 +1520,7 @@ var ContactName = function(formatted, familyName, givenName, middle, prefix, suf
 
 module.exports = ContactName;
 
-})
+});
 
 // file: lib/common/plugin/ContactOrganization.js
 define("cordova/plugin/ContactOrganization", function(require, exports, module) {
@@ -1477,7 +1548,7 @@ var ContactOrganization = function(pref, type, name, dept, title) {
 
 module.exports = ContactOrganization;
 
-})
+});
 
 // file: lib/common/plugin/Coordinates.js
 define("cordova/plugin/Coordinates", function(require, exports, module) {
@@ -1525,7 +1596,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) {
 
 module.exports = Coordinates;
 
-})
+});
 
 // file: lib/common/plugin/DirectoryEntry.js
 define("cordova/plugin/DirectoryEntry", function(require, exports, module) {
@@ -1610,7 +1681,7 @@ DirectoryEntry.prototype.getFile = function(path, options, successCallback, erro
 
 module.exports = DirectoryEntry;
 
-})
+});
 
 // file: lib/common/plugin/DirectoryReader.js
 define("cordova/plugin/DirectoryReader", function(require, exports, module) {
@@ -1656,7 +1727,7 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
 
 module.exports = DirectoryReader;
 
-})
+});
 
 // file: lib/common/plugin/Entry.js
 define("cordova/plugin/Entry", function(require, exports, module) {
@@ -1864,7 +1935,7 @@ Entry.prototype.getParent = function(successCallback, errorCallback) {
 
 module.exports = Entry;
 
-})
+});
 
 // file: lib/common/plugin/File.js
 define("cordova/plugin/File", function(require, exports, module) {
@@ -1887,7 +1958,7 @@ var File = function(name, fullPath, type, lastModifiedDate, size){
 
 module.exports = File;
 
-})
+});
 
 // file: lib/common/plugin/FileEntry.js
 define("cordova/plugin/FileEntry", function(require, exports, module) {
@@ -1955,7 +2026,7 @@ FileEntry.prototype.file = function(successCallback, errorCallback) {
 
 module.exports = FileEntry;
 
-})
+});
 
 // file: lib/common/plugin/FileError.js
 define("cordova/plugin/FileError", function(require, exports, module) {
@@ -1985,7 +2056,7 @@ FileError.PATH_EXISTS_ERR = 12;
 
 module.exports = FileError;
 
-})
+});
 
 // file: lib/common/plugin/FileReader.js
 define("cordova/plugin/FileReader", function(require, exports, module) {
@@ -2239,7 +2310,7 @@ FileReader.prototype.readAsArrayBuffer = function(file) {
 
 module.exports = FileReader;
 
-})
+});
 
 // file: lib/common/plugin/FileSystem.js
 define("cordova/plugin/FileSystem", function(require, exports, module) {
@@ -2261,7 +2332,7 @@ var FileSystem = function(name, root) {
 
 module.exports = FileSystem;
 
-})
+});
 
 // file: lib/common/plugin/FileTransfer.js
 define("cordova/plugin/FileTransfer", function(require, exports, module) {
@@ -2281,8 +2352,9 @@ var FileTransfer = function() {};
 * @param successCallback (Function}  Callback to be invoked when upload has completed
 * @param errorCallback {Function}    Callback to be invoked upon error
 * @param options {FileUploadOptions} Optional parameters such as file name and mimetype
+* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false
 */
-FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, debug) {
+FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) {
     // check for options
     var fileKey = null;
     var fileName = null;
@@ -2304,7 +2376,7 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
         }
     }
 
-    exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, debug, chunkedMode]);
+    exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode]);
 };
 
 /**
@@ -2334,7 +2406,7 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
 
 module.exports = FileTransfer;
 
-})
+});
 
 // file: lib/common/plugin/FileTransferError.js
 define("cordova/plugin/FileTransferError", function(require, exports, module) {
@@ -2352,7 +2424,7 @@ FileTransferError.CONNECTION_ERR = 3;
 
 module.exports = FileTransferError;
 
-})
+});
 
 // file: lib/common/plugin/FileUploadOptions.js
 define("cordova/plugin/FileUploadOptions", function(require, exports, module) {
@@ -2373,7 +2445,7 @@ var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
 
 module.exports = FileUploadOptions;
 
-})
+});
 
 // file: lib/common/plugin/FileUploadResult.js
 define("cordova/plugin/FileUploadResult", function(require, exports, module) {
@@ -2389,7 +2461,7 @@ var FileUploadResult = function() {
 
 module.exports = FileUploadResult;
 
-})
+});
 
 // file: lib/common/plugin/FileWriter.js
 define("cordova/plugin/FileWriter", function(require, exports, module) {
@@ -2553,7 +2625,7 @@ FileWriter.prototype.seek = function(offset) {
         throw new FileError(FileError.INVALID_STATE_ERR);
     }
 
-    if (!offset) {
+    if (!offset && offset != 0) {
         return;
     }
 
@@ -2647,7 +2719,7 @@ FileWriter.prototype.truncate = function(size) {
 
 module.exports = FileWriter;
 
-})
+});
 
 // file: lib/common/plugin/Flags.js
 define("cordova/plugin/Flags", function(require, exports, module) {
@@ -2667,7 +2739,7 @@ function Flags(create, exclusive) {
 
 module.exports = Flags;
 
-})
+});
 
 // file: lib/common/plugin/LocalFileSystem.js
 define("cordova/plugin/LocalFileSystem", function(require, exports, module) {
@@ -2685,7 +2757,7 @@ LocalFileSystem.PERSISTENT = 1; //persistent
 
 module.exports = LocalFileSystem;
 
-})
+});
 
 // file: lib/common/plugin/Media.js
 define("cordova/plugin/Media", function(require, exports, module) {
@@ -2877,7 +2949,7 @@ Media.onStatus = function(id, msg, value) {
 
 module.exports = Media;
 
-})
+});
 
 // file: lib/common/plugin/MediaError.js
 define("cordova/plugin/MediaError", function(require, exports, module) {
@@ -2898,7 +2970,7 @@ MediaError.MEDIA_ERR_NONE_SUPPORTED = 4;
 
 module.exports = MediaError;
 
-})
+});
 
 // file: lib/common/plugin/MediaFile.js
 define("cordova/plugin/MediaFile", function(require, exports, module) {
@@ -2959,7 +3031,7 @@ MediaFile.cast = function(pluginResult) {
 
 module.exports = MediaFile;
 
-})
+});
 
 // file: lib/common/plugin/MediaFileData.js
 define("cordova/plugin/MediaFileData", function(require, exports, module) {
@@ -2982,7 +3054,7 @@ var MediaFileData = function(codecs, bitrate, height, width, duration){
 
 module.exports = MediaFileData;
 
-})
+});
 
 // file: lib/common/plugin/Metadata.js
 define("cordova/plugin/Metadata", function(require, exports, module) {
@@ -2997,7 +3069,7 @@ var Metadata = function(time) {
 
 module.exports = Metadata;
 
-})
+});
 
 // file: lib/common/plugin/Position.js
 define("cordova/plugin/Position", function(require, exports, module) {
@@ -3010,7 +3082,7 @@ var Position = function(coords, timestamp) {
 
 module.exports = Position;
 
-})
+});
 
 // file: lib/common/plugin/PositionError.js
 define("cordova/plugin/PositionError", function(require, exports, module) {
@@ -3032,7 +3104,7 @@ PositionError.TIMEOUT = 3;
 
 module.exports = PositionError;
 
-})
+});
 
 // file: lib/common/plugin/ProgressEvent.js
 define("cordova/plugin/ProgressEvent", function(require, exports, module) {
@@ -3083,7 +3155,7 @@ var ProgressEvent = (function() {
 
 module.exports = ProgressEvent;
 
-})
+});
 
 // file: lib/common/plugin/accelerometer.js
 define("cordova/plugin/accelerometer", function(require, exports, module) {
@@ -3183,7 +3255,7 @@ var accelerometer = {
 
 module.exports = accelerometer;
 
-})
+});
 
 // file: lib/common/plugin/battery.js
 define("cordova/plugin/battery", function(require, exports, module) {
@@ -3275,7 +3347,7 @@ var battery = new Battery();
 
 module.exports = battery;
 
-})
+});
 
 // file: lib/common/plugin/capture.js
 define("cordova/plugin/capture", function(require, exports, module) {
@@ -3352,7 +3424,7 @@ Capture.prototype.captureVideo = function(successCallback, errorCallback, option
 
 module.exports = new Capture();
 
-})
+});
 
 // file: lib/common/plugin/compass.js
 define("cordova/plugin/compass", function(require, exports, module) {
@@ -3370,7 +3442,7 @@ var exec = require('cordova/exec'),
          * getting the heading data.
          * @param {CompassOptions} options The options for getting the heading data (not used).
          */
-        getCurrentHeading:function(successCallback, errorCallback) {
+        getCurrentHeading:function(successCallback, errorCallback, options) {
             // successCallback required
             if (typeof successCallback !== "function") {
               console.log("Compass Error: successCallback is not a function");
@@ -3393,7 +3465,7 @@ var exec = require('cordova/exec'),
             }
             
             // Get heading
-            exec(win, fail, "Compass", "getHeading", []);
+            exec(win, fail, "Compass", "getHeading", [options]);
         },
 
         /**
@@ -3403,11 +3475,13 @@ var exec = require('cordova/exec'),
          * @param {Function} errorCallback The function to call when there is an error 
          * getting the heading data.
          * @param {HeadingOptions} options The options for getting the heading data
-         * such as timeout and the frequency of the watch.
+         * such as timeout and the frequency of the watch. For iOS, filter parameter
+         * specifies to watch via a distance filter rather than time.
          */
         watchHeading:function(successCallback, errorCallback, options) {
             // Default interval (100 msec)
             var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100;
+            var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0;
 
             // successCallback required
             if (typeof successCallback !== "function") {
@@ -3421,13 +3495,18 @@ var exec = require('cordova/exec'),
               return;
             }
 
-            // Start watch timer to get headings
             var id = utils.createUUID();
-
-            timers[id] = window.setInterval(function() {
-                compass.getCurrentHeading(successCallback, errorCallback);
-            }, frequency);
-
+			if (filter > 0) {
+				// is an iOS request for watch by filter, no timer needed
+				timers[id] = "iOS";
+				compass.getCurrentHeading(successCallback, errorCallback, options);
+			} else {
+				// Start watch timer to get headings
+            	timers[id] = window.setInterval(function() {
+                	compass.getCurrentHeading(successCallback, errorCallback);
+            	}, frequency);
+			}
+				
             return id;
         },
 
@@ -3438,16 +3517,20 @@ var exec = require('cordova/exec'),
         clearWatch:function(id) {
             // Stop javascript timer & remove from timer list
             if (id && timers[id]) {
-              clearInterval(timers[id]);
-              delete timers[id];
+            	if (timers[id] != "iOS") {
+              		clearInterval(timers[id]);
+              	} else {
+            		// is iOS watch by filter so call into device to stop
+            		exec(null, null, "Compass", "stopHeading", []);
+            	}
+	            delete timers[id];
             }
         }
-        // TODO: add the filter-based iOS-only methods
     };
 
 module.exports = compass;
 
-})
+});
 
 // file: lib/common/plugin/contacts.js
 define("cordova/plugin/contacts", function(require, exports, module) {
@@ -3509,7 +3592,7 @@ var contacts = {
 
 module.exports = contacts;
 
-})
+});
 
 // file: lib/common/plugin/geolocation.js
 define("cordova/plugin/geolocation", function(require, exports, module) {
@@ -3608,7 +3691,7 @@ var geolocation = {
 
 module.exports = geolocation;
 
-})
+});
 
 // file: lib/common/plugin/network.js
 define("cordova/plugin/network", function(require, exports, module) {
@@ -3673,7 +3756,7 @@ NetworkConnection.prototype.getInfo = function (successCallback, errorCallback)
 
 module.exports = new NetworkConnection();
 
-})
+});
 
 // file: lib/common/plugin/notification.js
 define("cordova/plugin/notification", function(require, exports, module) {
@@ -3734,7 +3817,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/playbook/plugin/playbook/device.js
 define("cordova/plugin/playbook/device", function(require, exports, module) {
@@ -3763,7 +3846,7 @@ channel.onCordovaReady.subscribeOnce(function() {
 
 module.exports = me;
 
-})
+});
 
 // file: lib/playbook/plugin/playbook/manager.js
 define("cordova/plugin/playbook/manager", function(require, exports, module) {
@@ -4091,7 +4174,7 @@ module.exports = {
     destroy: function () {}
 };
 
-})
+});
 
 // file: lib/common/plugin/requestFileSystem.js
 define("cordova/plugin/requestFileSystem", function(require, exports, module) {
@@ -4136,7 +4219,7 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) {
 
 module.exports = requestFileSystem;
 
-})
+});
 
 // file: lib/common/plugin/resolveLocalFileSystemURI.js
 define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) {
@@ -4182,7 +4265,7 @@ module.exports = function(uri, successCallback, errorCallback) {
     exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
 };
 
-})
+});
 
 // file: lib/webworks/plugin/webworks/manager.js
 define("cordova/plugin/webworks/manager", function(require, exports, module) {
@@ -4201,7 +4284,7 @@ module.exports = {
     }
 };
 
-})
+});
 
 // file: lib/common/utils.js
 define("cordova/utils", function(require, exports, module) {
@@ -4310,7 +4393,7 @@ var _self = {
 
 module.exports = _self;
 
-})
+});
 
 
 window.cordova = require('cordova');


Mime
View raw message