eventize-js
Advanced tools
Comparing version 0.0.8 to 0.0.9
/** | ||
* =============================================================== | ||
* eventize.js v0.0.8 -- https://github.com/spearwolf/eventize | ||
* eventize.js v0.0.9 -- https://github.com/spearwolf/eventize | ||
* =============================================================== | ||
@@ -20,2 +20,2 @@ * | ||
*/ | ||
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.eventize=n()}}(function(){return function n(e,t,r){function o(f,u){if(!t[f]){if(!e[f]){var c="function"==typeof require&&require;if(!u&&c)return c(f,!0);if(i)return i(f,!0);var a=Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var l=t[f]={exports:{}};e[f][0].call(l.exports,function(n){var t=e[f][1][n];return o(t?t:n)},l,l.exports,n,e,t,r)}return t[f].exports}for(var i="function"==typeof require&&require,f=0;f<r.length;f++)o(r[f]);return o}({1:[function(n,e,t){"use strict";function r(n){function e(){return++d.lastCallbackId}function t(n,e){return n.prio!==e.prio?e.prio-n.prio:n.id-e.id}function l(n){if(n){var e=d.boundObjects.indexOf(n);return-1===e&&d.boundObjects.push(n),n}}function s(n,e,t){var o,i,f,u;for(i in t)t.hasOwnProperty(i)&&(f=e[i],"function"==typeof f&&(o=t[i],Array.isArray(o)?(u=o[0],o=o[1]):u=r.PRIO_DEFAULT,n.on(o,u,f)));return n}function p(n,e,t){function o(){var e,r,o;if(p)for(e=0;p>e;e++)r=d.boundObjects[e],r[u]?t(null,r):(o=r[n],"function"==typeof o&&t(o,r))}if(!(y.silenced||y.off.indexOf(n)>=0)){var i,f,a,l=d.callbacks[n],s=d.callbacks[c],p=d.boundObjects.length,g=!1;if(l||s.length)for(l=l?l.concat(s):s,f=l.length,i=0;f>i;i++)a=l[i],!g&&a&&a.prio<r.PRIO_DEFAULT&&(o(),g=!0),e(a);g||o()}}if(n[u])return n;var d={lastCallbackId:0,callbacks:{},boundObjects:[]};d.callbacks[c]=[];var y=i({},{silenced:!1,off:[]});return f(n,u,y),void 0===r.PRIO_DEFAULT&&i(r,{PRIO_MAX:Number.POSITIVE_INFINITY,PRIO_A:1e9,PRIO_B:1e7,PRIO_C:1e5,PRIO_DEFAULT:0,PRIO_LOW:-1e5,PRIO_MIN:Number.NEGATIVE_INFINITY}),n.on=function(n,f,u){var l=arguments.length;if(0===l)return void(y.silenced&&(o(y,"silenced",!1),y.off.length=0));var s;if(1===l){if("string"==typeof n)return s=y.off.indexOf(n),void(s>=0&&y.off.splice(s,1));if("object"!=typeof n&&"function"!=typeof n)return void console.warn(a,".on() called with insufficient arguments!",arguments);u=n,n=c,f=r.PRIO_DEFAULT}2===l&&(u=f,f=r.PRIO_DEFAULT);var p=d.callbacks,g=p[n]||(p[n]=[]),v=e(),b=i({},{id:v,fn:u,prio:"number"!=typeof f?r.PRIO_DEFAULT:f,isFunction:"function"==typeof u});return g.push(b),g.sort(t),v},n.once=function(e,t,o){var i=arguments.length;if(!i||i>3)return void console.warn(a,".once() called with insufficient arguments!",arguments);1===i?(o=e,e=c,t=r.PRIO_DEFAULT):2===i&&(o=t,t=r.PRIO_DEFAULT);var f=n.on(e,t,function(){var e=o.apply(this,arguments);return n.off(f),e});return f},n.off=function(n){if(0===arguments.length)return void(y.silenced||(o(y,"silenced",!0),y.off.length=0));if("string"==typeof n)return void(-1===y.off.indexOf(n)&&y.off.push(n));var e,t,r,i,f,u=d.callbacks,c="object"==typeof n;if("number"==typeof n||"function"==typeof n||c)for(f=Object.keys(u),r=0;r<f.length;r++)for(i=u[f[r]],t=0;t<i.length;t++)if(e=i[t],(e.id===n||e.fn===n)&&(i.splice(t,1),!c))return;c&&(t=d.boundObjects.indexOf(n),t>=0&&d.boundObjects.splice(t,1))},n.connect=function(n,e){var t=arguments.length;return 1===t?l(n):2===t?s(this,n,e):void console.warn(a,".connect() called with insufficient arguments!",arguments)},n.emit=function(n){var e,t,r,o=this;arguments.length>1&&"string"!=typeof arguments[0]&&"string"==typeof arguments[1]?(t=Array.prototype.slice.call(arguments,2),n=arguments[1],e=arguments[0],t[t.length-1]=e,r=t):(t=Array.prototype.slice.call(arguments,1),r=t.concat([o])),p(n,function(e){if(e.isFunction)e.fn.apply(o,t);else if(e.fn[u])e.fn.emit.apply(e.fn,[n].concat(t));else{var i=e.fn[n];"function"==typeof i&&i.apply(e.fn,r)}},function(e,t){e?e.apply(t,r):t.emit.apply(t,[o,n].concat(r))})},n.emitReduce=function(n){function e(n){void 0!==n&&(t=n)}var t,r=Array.prototype.slice.call(arguments,1);0===r.length?(t={},r.push(t)):e(r[0]);var o=this,i=[n].concat(r),f=r.concat([o]);return p(n,function(c){if(c.isFunction)r[0]=t,e(c.fn.apply(o,r));else if(c.fn[u])i[1]=t,e(c.fn.emitReduce.apply(c.fn,i));else{var a=c.fn[n];"function"==typeof a&&(f[0]=t,e(a.apply(c.fn,f)))}},function(n,r){n&&(f[0]=t,e(n.apply(r,f)))}),t},n}function o(n,e,t){return Object.defineProperty(n,e,{value:t,configurable:!0,enumerable:!0}),n}function i(n,e){var t,r=Object.keys(e);for(t=r.length;t--;)o(n,r[t],e[r[t]]);return n}function f(n,e,t){return Object.defineProperty(n,e,{value:t,configurable:!0}),n}var u="_eventize",c="*",a="[eventize.js]";r.is=function(n){return!(!n||!n[u])},e.exports=r},{}]},{},[1])(1)}); | ||
!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.eventize=n()}}(function(){return function n(e,t,o){function i(f,c){if(!t[f]){if(!e[f]){var u="function"==typeof require&&require;if(!c&&u)return u(f,!0);if(r)return r(f,!0);var l=Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l}var a=t[f]={exports:{}};e[f][0].call(a.exports,function(n){var t=e[f][1][n];return i(t?t:n)},a,a.exports,n,e,t,o)}return t[f].exports}for(var r="function"==typeof require&&require,f=0;f<o.length;f++)i(o[f]);return i}({1:[function(n,e,t){"use strict";function o(n){function e(){return++d.lastCallbackId}function t(n,e){return n.prio!==e.prio?e.prio-n.prio:n.id-e.id}function a(n){if(n){var e=d.boundObjects.indexOf(n);return-1===e&&d.boundObjects.push(n),n}}function s(n,e,t){var i,r,f,c;for(r in t)t.hasOwnProperty(r)&&(f=e[r],"function"==typeof f&&(i=t[r],Array.isArray(i)?(c=i[0],i=i[1]):c=o.PRIO_DEFAULT,n.on(i,c,f)));return n}function p(n,e,t){function i(){var e,o,i;if(p)for(e=0;p>e;e++)o=d.boundObjects[e],o[c]?t(null,o):(i=o[n],"function"==typeof i&&t(i,o))}if(!(y.silenced||y.off.indexOf(n)>=0)){var r,f,l,a=d.callbacks[n],s=d.callbacks[u],p=d.boundObjects.length,v=!1;if(a||s.length)for(a=a?a.concat(s):s,f=a.length,r=0;f>r;r++)l=a[r],!v&&l&&l.prio<o.PRIO_DEFAULT&&(i(),v=!0),e(l);v||i()}}if(n[c])return n;var d={lastCallbackId:0,callbacks:{},boundObjects:[]};d.callbacks[u]=[];var y=r({},{silenced:!1,off:[]});return f(n,c,y),void 0===o.PRIO_DEFAULT&&r(o,{PRIO_MAX:Number.POSITIVE_INFINITY,PRIO_A:1e9,PRIO_B:1e7,PRIO_C:1e5,PRIO_DEFAULT:0,PRIO_LOW:-1e5,PRIO_MIN:Number.NEGATIVE_INFINITY}),n.on=function(n,f,c){var a=arguments.length;if(0===a)return void(y.silenced&&(i(y,"silenced",!1),y.off.length=0));var s;if(1===a){if("string"==typeof n)return s=y.off.indexOf(n),void(s>=0&&y.off.splice(s,1));if("object"!=typeof n&&"function"!=typeof n)return void console.warn(l,".on() called with insufficient arguments!",arguments);c=n,n=u,f=o.PRIO_DEFAULT}2===a&&(c=f,f=o.PRIO_DEFAULT);var p=d.callbacks,v=p[n]||(p[n]=[]),b=e(),O=r({},{id:b,fn:c,prio:"number"!=typeof f?o.PRIO_DEFAULT:f,isFunction:"function"==typeof c});return v.push(O),v.sort(t),b},n.once=function(e,t,i){var r=arguments.length;if(!r||r>3)return void console.warn(l,".once() called with insufficient arguments!",arguments);1===r?(i=e,e=u,t=o.PRIO_DEFAULT):2===r&&(i=t,t=o.PRIO_DEFAULT);var f=n.on(e,t,function(){var e=i.apply(this,arguments);return n.off(f),e});return f},n.off=function(n){if(0===arguments.length)return void(y.silenced||(i(y,"silenced",!0),y.off.length=0));if("string"==typeof n)return void(-1===y.off.indexOf(n)&&y.off.push(n));var e,t,o,r,f,c=d.callbacks,u="object"==typeof n;if("number"==typeof n||"function"==typeof n||u)for(f=Object.keys(c),o=0;o<f.length;o++)for(r=c[f[o]],t=0;t<r.length;t++)if(e=r[t],(e.id===n||e.fn===n)&&(r.splice(t,1),!u))return;u&&(t=d.boundObjects.indexOf(n),t>=0&&d.boundObjects.splice(t,1))},n.connect=function(n,e){var t=arguments.length;return 1===t?a(n):2===t?s(this,n,e):void console.warn(l,".connect() called with insufficient arguments!",arguments)},n.emit=function(n){var e,t,o,i=this;arguments.length>1&&"string"!=typeof arguments[0]&&"string"==typeof arguments[1]?(t=Array.prototype.slice.call(arguments,2),n=arguments[1],e=arguments[0],t[t.length-1]=e,o=t):(t=Array.prototype.slice.call(arguments,1),o=t.concat([i])),p(n,function(e){if(e.isFunction)e.fn.apply(i,t);else if(e.fn[c])e.fn.emit.apply(e.fn,[n].concat(t));else{var r=e.fn[n];"function"==typeof r&&r.apply(e.fn,o)}},function(e,t){e?e.apply(t,o):t.emit.apply(t,[i,n].concat(o))})},n.emitReduce=function(n){function e(n){void 0!==n&&(t=n)}var t,o=Array.prototype.slice.call(arguments,1);0===o.length?(t={},o.push(t)):e(o[0]);var i=this,r=[n].concat(o),f=o.concat([i]);return p(n,function(u){if(u.isFunction)o[0]=t,e(u.fn.apply(i,o));else if(u.fn[c])r[1]=t,e(u.fn.emitReduce.apply(u.fn,r));else{var l=u.fn[n];"function"==typeof l&&(f[0]=t,e(l.apply(u.fn,f)))}},function(n,o){n&&(f[0]=t,e(n.apply(o,f)))}),t},n}function i(n,e,t){return Object.defineProperty(n,e,{value:t,configurable:!0,enumerable:!0}),n}function r(n,e){var t,o=Object.keys(e);for(t=o.length;t--;)i(n,o[t],e[o[t]]);return n}function f(n,e,t){return Object.defineProperty(n,e,{value:t,configurable:!0}),n}var c="_eventize",u="*",l="[eventize.js]";o.is=function(n){return!(!n||!n[c])},e.exports=o},{}]},{},[1])(1)}); |
{ | ||
"name": "eventize-js", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"author": { | ||
@@ -14,3 +14,3 @@ "name": "Wolfger Schramm", | ||
"license": "Apache-2.0", | ||
"main": "eventize.js", | ||
"main": "src/eventize.js", | ||
"homepage": "https://github.com/spearwolf/eventize/", | ||
@@ -21,9 +21,31 @@ "bugs": { | ||
"scripts": { | ||
"build": "cat ./src/LICENSE.js |sed -e 's/#VERSION#/'$(node -e 'console.log(require(\"./package.json\").version)')'/' >eventize.js && ./node_modules/browserify/bin/cmd.js --standalone eventize src/eventize.js |./node_modules/uglify-js/bin/uglifyjs - -m -c 'sequences=true,dead_code=true,drop_debugger=true,unsafe=true,conditionals=true,booleans=true,loops=true,unused=true,if_return=true,join_vars=true,cascade=true' --screw-ie8 >>eventize.js", | ||
"build": "./node_modules/gulp/bin/gulp.js", | ||
"test": "npm run build && npm run jasmine", | ||
"jasmine": "./node_modules/jasmine/bin/jasmine.js", | ||
"karma": "./node_modules/karma/bin/karma start karma.conf.js" | ||
"karma": "./node_modules/karma/bin/karma start karma.conf.js", | ||
"istanbul": "./node_modules/istanbul/lib/cli.js cover node_modules/jasmine/bin/jasmine.js", | ||
"all": "npm run test && npm run karma && npm run istanbul" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.6.4", | ||
"babel-plugin-transform-decorators": "^6.6.4", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.6.4", | ||
"babel-plugin-transform-object-assign": "^6.5.0", | ||
"babel-plugin-transform-runtime": "^6.6.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"babel-register": "^6.6.5", | ||
"babel-runtime": "^6.6.1", | ||
"babelify": "^7.2.0", | ||
"browserify": "^13.0.0", | ||
"glob": "^7.0.3", | ||
"gulp": "^3.9.1", | ||
"gulp-exit": "0.0.2", | ||
"gulp-insert": "^0.5.0", | ||
"gulp-size": "^2.0.0", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-uglify": "^1.5.3", | ||
"gulp-util": "^3.0.7", | ||
"gulp-webserver": "^0.9.1", | ||
"istanbul": "^0.4.2", | ||
"jasmine": "^2.4.1", | ||
@@ -36,4 +58,6 @@ "karma": "^0.13.21", | ||
"uglify-js": "^2.6.1", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.1.0", | ||
"watchify": "^3.7.0" | ||
} | ||
} |
155
README.md
# eventize.js | ||
[](https://www.npmjs.com/package/eventize-js) | ||
[](https://travis-ci.org/spearwolf/eventize) | ||
@@ -19,3 +20,3 @@ | ||
```javascript | ||
const eventize = require('eventize'); | ||
const eventize = require('eventize-js'); | ||
@@ -37,32 +38,26 @@ var obj = eventize({}); | ||
## API | ||
## Installation | ||
### The _eventize_ API | ||
--- | ||
#### `eventize()` | ||
``` | ||
eventize( obj ) | ||
npm install eventize-js | ||
``` | ||
Attach the _eventized object_ **api** to an object. Returns the object. | ||
--- | ||
# API | ||
#### `eventize.is()` | ||
## The _eventize_ API | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/eventize.svg" alt="eventize()" width="240"> | ||
``` | ||
eventize.is( obj ) | ||
eventize( obj ) | ||
``` | ||
Check if the given object is _eventized_ (has the _eventized object_ **api**). Returns `true` or `false` | ||
Attach the _eventized object_ **api** to an object. Returns the `obj`. | ||
### The _eventized object_ API | ||
--- | ||
## The _eventized object_ API | ||
#### `on()` | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/on.svg" alt="on()" width="96"> | ||
@@ -77,20 +72,19 @@ ``` | ||
Adds a listener to an event name. | ||
Registers a listener to be executed whenever `eventName` gets fired. | ||
The **priority** is optional and should be a _number_. The _default_ **priority** is defined by `eventize.PRIO_DEFAULT` (which is `0` by default) | ||
- Define the listener by a _callback function_ (`callbackFunc`) or by an _object reference_ (`object`). | ||
- The `priority` is optional and should be a _number_. The _default_ `priority` is defined by `eventize.PRIO_DEFAULT` (which is `0` by default). | ||
- The `eventName` is mandatory and should be a _string_. | ||
- Returns a listener _de-registration id_ (which is a *number*). Use the *id* to unregister your listener via `off()`. | ||
The **eventName** is mandatory and should be a _string_. | ||
The _catch'm all_ **eventName** `*` is special: listeners will be called .. | ||
Use `*` as `eventName` to create a _catch'm all_ listener. Catch'm all listeners will be called .. | ||
- regardless off the event name | ||
- _after_ all other listeners with _same priority_ | ||
- but _after_ all other listeners within _same priority_ | ||
Returns an *id* as *number*. Use this *id* to unregister your listener via `off()` | ||
##### Define listener by object | ||
_DEFINE A LISTENER BY OBJECT_ | ||
- When the event is fired, a method with the same name as the event will be called (but only if such a method exists otherwise nothing will happen) | ||
- When the listener is an _eventized object_ and a event is fired, the `emit()` method of the listener object will be called | ||
- When the event is fired, a method with the same name as the event will be called | ||
- When the listener is an _eventized object_ and a event is fired, the `emit()` method will be called | ||
``` | ||
@@ -101,8 +95,6 @@ obj.on( eventName ) | ||
Reactivate all listeners or by event name. You can deactivate listeners with `obj.off()` | ||
Re-activates all listeners or by event name. You can de-activate listeners with `off()`. | ||
--- | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/once.svg" alt="once()" width="144"> | ||
#### `once()` | ||
``` | ||
@@ -116,16 +108,20 @@ obj.once( eventName, [ priority, ] callbackFunc ) | ||
Adds a listener to an event name. | ||
__The listener will be removed after the function gets called once.__ | ||
Apart from that `once()` works like `on()` | ||
Registers a listener to be executed when `eventName` gets fired. **Once the listener is called, de-register the listener.** | ||
Apart from that `once()` works like `on()`. | ||
--- | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/connect.svg" alt="connect()" width="216"> | ||
#### `connect()` | ||
``` | ||
obj.connect( object ) | ||
``` | ||
Binds an object or multiple functions to multiple events. | ||
Has almost the same effect as writing `obj.on(object)` but this **should be the preferred way** (there are some differences affecting the _sender context_ argument passed over to _eventized object listener_ .. see `emit()` for more details). | ||
``` | ||
obj.connect( object ) | ||
obj.connect( object, mapping ) | ||
``` | ||
Bind multiple functions to events. | ||
Binds multiple functions from an object to multiple events configured by a mapping. Configure the _event name_ to _function name_ mapping with an optional priority for each event. | ||
@@ -139,6 +135,8 @@ ##### Examples | ||
foo () { console.log('hello') } | ||
bar (sender) { console.log(obj === sender) } | ||
}); | ||
obj.emit('foo'); // => 'hello' | ||
obj.emit('bar'); // nothing will happen | ||
obj.emit('bar'); // => 'true' | ||
obj.emit('plah'); // nothing will happen | ||
``` | ||
@@ -158,11 +156,10 @@ | ||
--- | ||
#### `emit()` | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/emit.svg" alt="emit()" width="144"> | ||
``` | ||
obj.emit( eventName [, arguments .. ] ) | ||
obj.emit( eventName [, args... ] ) | ||
``` | ||
Fire an event. | ||
_Fire an event._ | ||
@@ -172,26 +169,28 @@ All listeners will be called in (1st) _priority_ and (2nd) _creation time_ order. | ||
There are two expections of this rule: | ||
- _catch'm all_ event listeners will be called _after_ all other listeners within _same priority_ | ||
- listeners registered by `connect()` will be called with _priority_ = `eventize.PRIO_DEFAULT` BUT _before_ the _catch'm all_ listeners for this priority. | ||
- _catch'm all_ listeners will be called **after** _all_ other listeners within _same priority_ | ||
- listeners registered by `connect()` will be called with `priority = eventize.PRIO_DEFAULT` BUT _before_ all _catch'm all_ listeners for this priority. | ||
`emit()` will not return any value (*undefined*). | ||
_You should NOT emit the **catch'm all** event!_ | ||
The context (that's the `this` reference) of your listener depends on .. | ||
- when registered by _callback function_ | ||
- .. is the sender context (that's your _eventized object_ which has the `emit()` method) | ||
- when registered by _object reference_ or by `connect()` | ||
- .. is, of course, the listener! | ||
##### The Listener Context | ||
All additional arguments will be transferred to the listeners. | ||
(the `this` reference _inside_ your listener function) | ||
Returns nothing (*undefined*). | ||
- When the listener is registered by a _callback function_, is the *sender context* (this is your _eventized object_ which owns the `emit()` method) | ||
- When the listener is registered by an _object reference_ or by `connect()`, is, of course, the listener object itself! | ||
All listeners which are registered by _object reference_ via `on()` or by `connect()` will receive an extra argument (as last arg) which is a reference to the _sender object_. | ||
All additional `args` will be transferred to the listener. | ||
_SENDER OBJECTS_ | ||
All _object_ listeners (which are registered by _object reference_ via `on()` or by `connect()`) will receive an extra argument | ||
(as last argument) which is a reference to the _sender object_. | ||
The difference between `a.on('*', obj)` and `a.connect(obj)` is .. | ||
- _connected_ objects will always get a reference to the _emitting_ object (that's the object which is executing `emit()`) | ||
- _object_ listeners registered by `a.on()` will always get a reference to the object in which they were _filed_ | ||
##### Sender Object | ||
The _sender object_ passed into the listener as additional argument is defined by how the listener was registered .. | ||
- _connected_ objects (registered by `connect()`) will always get a reference to the _emitting_ object (that is the object which is executing `emit()`) | ||
- _object_ listeners registered by `a.on()` will always get a reference to the object in which they were _filed_ (that is the object with `.on()`) | ||
##### Examples | ||
@@ -227,13 +226,13 @@ | ||
--- | ||
#### `emitReduce()` | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/emitReduce.svg" alt="emitReduce()" width="288"> | ||
``` | ||
obj.emitReduce( eventName [, value= {} ] [, arguments .. ] ) | ||
obj.emitReduce( eventName [, value= {} ] [, args... ] ) | ||
``` | ||
Fire an event and returns a result. | ||
Fire an event and return a result. | ||
The *return value* from a listener is the *new* value used for the next listener in the call chain (unless the return value is `undefined`). | ||
The *return value* from a listener is the *new* `value` used for the next listener in the call chain (unless the return value is `undefined`). | ||
That means the *result* (return value from `emitReduce()`) is the return value from the _last called listener_. | ||
@@ -243,5 +242,4 @@ | ||
--- | ||
#### `off()` | ||
### <img src="https://cdn.rawgit.com/spearwolf/eventize/master/doc/images/off.svg" alt="off()" width="120"> | ||
@@ -256,7 +254,28 @@ ``` | ||
Remove a listener from an event. | ||
Removes a listener from an event. | ||
Deactivate listener by id or previously bound object or | ||
function reference or event name or silence all events. | ||
De-activate listener by `id` or previously bound `object` (registered by `.on()` or `.connect()`) or | ||
`callback` function reference or `eventName` or silence *all* events. | ||
## Extra API Helpers | ||
``` | ||
eventize.is( obj ) | ||
``` | ||
Check if `obj` is an _eventized object_ (has the _eventized object_ **api**). Returns `true` or `false` | ||
``` | ||
eventize.PRIO_MAX | ||
eventize.PRIO_A | ||
eventize.PRIO_B | ||
eventize.PRIO_C | ||
eventize.PRIO_DEFAULT = 0 | ||
eventize.PRIO_LOW | ||
eventize.PRIO_MIN | ||
``` | ||
Some predefined priorities. Use it or not. They are defined just for convenience. | ||
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
87747
28
1185
271
31
3