cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [6/7] ios commit: Update JS snapshot to version 4.4.0-dev (via coho)
Date Sat, 22 Oct 2016 09:26:21 GMT
Update JS snapshot to version 4.4.0-dev (via coho)


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

Branch: refs/heads/master
Commit: 1939b6385f590c7d6a75788060d70b8b7708c0ee
Parents: 7ba81d2
Author: Shazron Abdullah <shazron@apache.org>
Authored: Fri Oct 21 23:21:13 2016 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Fri Oct 21 23:21:13 2016 -0700

----------------------------------------------------------------------
 CordovaLib/cordova.js | 73 +++++++++++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/1939b638/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index ac01961..6d10ac3 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
 // Platform: ios
-// d403ce434788ffe1937711d6ebcbcc837fcbcb14
+// f28234fbc27c578b9a335f1dabfa2d1b96bfc03d
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var PLATFORM_VERSION_BUILD_LABEL = '4.3.0-dev';
+var PLATFORM_VERSION_BUILD_LABEL = '4.4.0-dev';
 // file: src/scripts/require.js
 
 /*jshint -W079 */
@@ -697,8 +697,13 @@ var Channel = function(type, sticky) {
         }
     };
 
-function forceFunction(f) {
-    if (typeof f != 'function') throw "Function required as first argument!";
+function checkSubscriptionArgument(argument) {
+    if (typeof argument !== "function" && typeof argument.handleEvent !== "function")
{
+        throw new Error(
+                "Must provide a function or an EventListener object " +
+                "implementing the handleEvent interface."
+        );
+    }
 }
 
 /**
@@ -708,28 +713,39 @@ function forceFunction(f) {
  * and a guid that can be used to stop subscribing to the channel.
  * Returns the guid.
  */
-Channel.prototype.subscribe = function(f, c) {
-    // need a function to call
-    forceFunction(f);
+Channel.prototype.subscribe = function(eventListenerOrFunction, eventListener) {
+    checkSubscriptionArgument(eventListenerOrFunction);
+    var handleEvent, guid;
+
+    if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
+        // Received an EventListener object implementing the handleEvent interface
+        handleEvent = eventListenerOrFunction.handleEvent;
+        eventListener = eventListenerOrFunction;
+    } else {
+        // Received a function to handle event
+        handleEvent = eventListenerOrFunction;
+    }
+
     if (this.state == 2) {
-        f.apply(c || this, this.fireArgs);
+        handleEvent.apply(eventListener || this, this.fireArgs);
         return;
     }
 
-    var func = f,
-        guid = f.observer_guid;
-    if (typeof c == "object") { func = utils.close(c, f); }
+    guid = eventListenerOrFunction.observer_guid;
+    if (typeof eventListener === "object") {
+        handleEvent = utils.close(eventListener, handleEvent);
+    }
 
     if (!guid) {
-        // first time any channel has seen this subscriber
+        // First time any channel has seen this subscriber
         guid = '' + nextGuid++;
     }
-    func.observer_guid = guid;
-    f.observer_guid = guid;
+    handleEvent.observer_guid = guid;
+    eventListenerOrFunction.observer_guid = guid;
 
     // Don't add the same handler more than once.
     if (!this.handlers[guid]) {
-        this.handlers[guid] = func;
+        this.handlers[guid] = handleEvent;
         this.numHandlers++;
         if (this.numHandlers == 1) {
             this.onHasSubscribersChange && this.onHasSubscribersChange();
@@ -740,12 +756,20 @@ Channel.prototype.subscribe = function(f, c) {
 /**
  * Unsubscribes the function with the given guid from the channel.
  */
-Channel.prototype.unsubscribe = function(f) {
-    // need a function to unsubscribe
-    forceFunction(f);
+Channel.prototype.unsubscribe = function(eventListenerOrFunction) {
+    checkSubscriptionArgument(eventListenerOrFunction);
+    var handleEvent, guid, handler;
+
+    if (eventListenerOrFunction && typeof eventListenerOrFunction === "object") {
+        // Received an EventListener object implementing the handleEvent interface
+        handleEvent = eventListenerOrFunction.handleEvent;
+    } else {
+        // Received a function to handle event
+        handleEvent = eventListenerOrFunction;
+    }
 
-    var guid = f.observer_guid,
-        handler = this.handlers[guid];
+    guid = handleEvent.observer_guid;
+    handler = this.handlers[guid];
     if (handler) {
         delete this.handlers[guid];
         this.numHandlers--;
@@ -817,7 +841,7 @@ module.exports = channel;
 
 });
 
-// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/exec.js
+// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/exec.js
 define("cordova/exec", function(require, exports, module) {
 
 /*global require, module, atob, document */
@@ -1545,7 +1569,7 @@ exports.reset();
 
 });
 
-// file: /Users/steveng/repo/cordova/cordova-ios/cordova-js-src/platform.js
+// file: /Users/shazron/Documents/git/apache/cordova-ios/cordova-js-src/platform.js
 define("cordova/platform", function(require, exports, module) {
 
 module.exports = {
@@ -1827,7 +1851,10 @@ utils.clone = function(obj) {
 
     retVal = {};
     for(i in obj){
-        if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined')
{
+        // https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned
in
+        // custom protocol activation case on Windows Phone 8.1 causing "No such interface
supported" exception
+        // on cloning.
+        if((!(i in retVal) || retVal[i] != obj[i]) && typeof obj[i] != 'undefined'
&& typeof obj[i] != 'unknown') {
             retVal[i] = utils.clone(obj[i]);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message