[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15553863#comment-15553863 ] ASF GitHub Bot commented on CB-3785: Github user rayshan commented on the issue: https://github.com/apache/cordova-js/pull/130 Yay! No worries. > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov >Assignee: Ray Shan > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15553505#comment-15553505 ] ASF GitHub Bot commented on CB-3785: Github user asfgit closed the pull request at: https://github.com/apache/cordova-js/pull/130 > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov >Assignee: Ray Shan > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15553506#comment-15553506 ] ASF GitHub Bot commented on CB-3785: Github user stevengill commented on the issue: https://github.com/apache/cordova-js/pull/130 Thanks @rayshan! Sorry it took so long to merge. > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov >Assignee: Ray Shan > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15553504#comment-15553504 ] ASF subversion and git services commented on CB-3785: - Commit 81d8b9924b78804017fbce2ee7bd3f92560d341a in cordova-js's branch refs/heads/master from [~rayshan] [ https://git-wip-us.apache.org/repos/asf?p=cordova-js.git;h=81d8b99 ] Fix CB-3785 Enable support of EventListener interface for Channel.prototype.subscribe / unsubscribe This closes #130 > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov >Assignee: Ray Shan > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15323038#comment-15323038 ] ASF GitHub Bot commented on CB-3785: Github user rayshan commented on the issue: https://github.com/apache/cordova-js/pull/130 Rebased > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov >Assignee: Ray Shan > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15086611#comment-15086611 ] ASF GitHub Bot commented on CB-3785: Github user stevengill commented on the pull request: https://github.com/apache/cordova-js/pull/130#issuecomment-169514704 Interesting. I'm reviewing > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov >Assignee: Ray Shan > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15065071#comment-15065071 ] ASF GitHub Bot commented on CB-3785: GitHub user rayshan opened a pull request: https://github.com/apache/cordova-js/pull/130 Fix CB-3785 - enable EventListener interface support This patch enables support for `EventListener` interface for `Channel.prototype.subscribe` / `unsubscribe`, based on the patch by @motorro in https://issues.apache.org/jira/browse/CB-3785. This bug prevents other frameworks that make heavy use of the EventListener interface to work with Cordova, such as [Montage](https://github.com/montagejs/montage) and its `EventManager`. You can merge this pull request into a Git repository by running: $ git pull https://github.com/rayshan/cordova-js master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-js/pull/130.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #130 commit 0cca16c84e6b95e29abbe68803d54b3f12ee9316 Author: Ray ShanDate: 2015-12-19T00:32:08Z Fix CB-3785 Enable support of EventListener interface for Channel.prototype.subscribe / unsubscribe > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-3785) Channel.prototype.subscribe to support EventListener interface
[ https://issues.apache.org/jira/browse/CB-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14994074#comment-14994074 ] Thibault Zanini commented on CB-3785: - Any updates about this issue? > Channel.prototype.subscribe to support EventListener interface > -- > > Key: CB-3785 > URL: https://issues.apache.org/jira/browse/CB-3785 > Project: Apache Cordova > Issue Type: Improvement > Components: CordovaJS >Affects Versions: 2.8.0 > Environment: All platforms >Reporter: Nikolai Kotchetkov > Labels: features, javascript, patch > Original Estimate: 1h > Remaining Estimate: 1h > > As number of Cordova-specific events use monkey-patch for add/remove/fire > listeners it would be nice if Channel functions support EventListener > interface: > - https://developer.mozilla.org/en-US/docs/Web/API/EventListener > - http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventListener > I assume only a small patch to Channel module is required. Here are the > modified functions to resolve the issue: > {code:javascript} > /** > * Subscribes the given function to the channel. Any time that > * Channel.fire is called so too will the function. > * Optionally specify an execution context for the function > * and a guid that can be used to stop subscribing to the channel. > * Returns the guid. > */ > Channel.prototype.subscribe = function(f, c) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to call > forceFunction(func); > if (this.state == 2) { > func.apply(c || this, this.fireArgs); > return; > } > var guid = f.observer_guid; > if (typeof c == "object") { func = utils.close(c, func); } > if (!guid) { > // first time any channel has seen this subscriber > guid = '' + nextGuid++; > } > func.observer_guid = guid; > f.observer_guid = guid; > // Don't add the same handler more than once. > if (!this.handlers[guid]) { > this.handlers[guid] = func; > this.numHandlers++; > if (this.numHandlers == 1) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > /** > * Unsubscribes the function with the given guid from the channel. > */ > Channel.prototype.unsubscribe = function(f) { > var func; > if (f && "object" === typeof f) { > // EventListener interface > func = f["handleEvent"]; > c = f; > } else { > // Function interface > func = f; > } > // need a function to unsubscribe > forceFunction(func); > var guid = f.observer_guid, > handler = this.handlers[guid]; > if (handler) { > delete this.handlers[guid]; > this.numHandlers--; > if (this.numHandlers === 0) { > this.onHasSubscribersChange && this.onHasSubscribersChange(); > } > } > }; > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org