Comparing version 1.0.2 to 1.0.3
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.updatable=e():t.updatable=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){function n(t,e){this.value=null,null!=t&&(this.value=t),this.listeners=[],e&&o(e)&&this.listeners.push(e)}function o(t){var e={};return t&&"[object Function]"===e.toString.call(t)}n.prototype.addListener=function(t){t&&o(t)&&this.listeners.push(t)},n.prototype.update=function(t){this.value=t;for(var e=0;e<this.listeners.length;e++)this.listeners[e](t)},n.prototype.setListener=function(t){t&&o(t)&&(this.listeners=[t])},n.prototype.getValue=function(){return this.value},t.exports=n}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.updatable=e():t.updatable=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){function n(t,e){this.value=null,null!=t&&(this.value=t),this.listeners=[],e&&r(e)&&this.listeners.push(e)}function r(t){var e={};return t&&"[object Function]"===e.toString.call(t)}n.prototype.addListener=function(t){t&&r(t)&&this.listeners.push(t)},n.prototype.update=function(t){this.value=t;for(var e=0;e<this.listeners.length;e++)this.listeners[e](t)},n.prototype.setListener=function(t){null==t?this.listeners=[]:t&&r(t)&&(this.listeners=[t])},n.prototype.getValue=function(){return this.value},t.exports=n}])}); |
{ | ||
"name": "updatable", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Updatable data type with listeners", | ||
@@ -22,3 +22,7 @@ "main": "dist/index.js", | ||
"listener" | ||
] | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github-sidhantpanda:sidhantpanda/updatable.git" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://travis-ci.org/sidhantpanda/updatable.svg?branch=master)](https://travis-ci.org/sidhantpanda/updatable) | ||
[![npm version](https://badge.fury.io/js/updatable.svg)](https://www.npmjs.com/package/updatable) [![Build Status](https://travis-ci.org/sidhantpanda/updatable.svg?branch=master)](https://travis-ci.org/sidhantpanda/updatable) | ||
@@ -45,1 +45,11 @@ # Updatable | ||
``` | ||
#### Remove all listeners (from v1.0.3) | ||
You can also set a completely new listener, discarding all previous listeners | ||
``` | ||
updatable.setListener(null); | ||
``` | ||
*** | ||
#### Changes in v1.0.3 | ||
* Calling `setListener(null)` will remove all previous listeners. However `setListener(undefined)` will not remove any listener. |
@@ -44,3 +44,5 @@ /** | ||
Updatable.prototype.setListener = function (cb) { | ||
if (cb && isFunction(cb)) { | ||
if (cb === null) { | ||
this.listeners = []; | ||
} else if (cb && isFunction(cb)) { | ||
this.listeners = [cb]; | ||
@@ -47,0 +49,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
86948
77
55
0