Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eventproxy

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventproxy - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

component.json

23

lib/eventproxy.js

@@ -18,3 +18,3 @@ /*global exports */

// Node.js Module
module.exports = definition();
module.exports = definition(require('debug')('eventproxy'));
} else {

@@ -24,3 +24,4 @@ // Assign to common namespaces or simply the global object (window)

}
})('EventProxy', function () {
})('EventProxy', function (debug) {
debug = debug || function () {};

@@ -56,2 +57,3 @@ /**

EventProxy.prototype.addListener = function (ev, callback) {
debug('Add listener for %s', ev);
this._callbacks = this._callbacks || {};

@@ -85,5 +87,7 @@ this._callbacks[ev] = this._callbacks[ev] || [];

if (!ev) {
debug('Remove all listeners');
this._callbacks = {};
} else if (calls) {
if (!callback) {
ev!== 'all' && debug('Remove all listeners of %s', ev);
calls[ev] = [];

@@ -98,2 +102,3 @@ } else {

if (callback === list[i]) {
ev!== 'all' && debug('Remove a listener of %s', ev);
list[i] = null;

@@ -132,2 +137,3 @@ break;

var calls = this._callbacks;
debug('Emit event %s with data %j', eventName, data);
while (both--) {

@@ -225,3 +231,3 @@ ev = both ? eventName : 'all';

}
debug('Assign listener for events %j, once is %s', events, !!isOnce);
length = events.length;

@@ -258,2 +264,3 @@ bind = function (key) {

}
debug('Events %j all emited with data %j', events, data);
callback.apply(null, data);

@@ -348,2 +355,3 @@ };

};
debug('After emit %s times, event %s\'s listenner will execute', times, eventName);
all = function (name, data) {

@@ -354,2 +362,3 @@ if (name === eventName) {

if (times < 1) {
debug('Event %s was emit %s, and execute the listenner', eventName, times);
proxy.unbind("all", all);

@@ -363,2 +372,3 @@ callback.apply(null, [firedData]);

if (times < 1) {
debug('Event %s was emit %s, and execute the listenner', eventName, times);
proxy.unbind("all", all);

@@ -400,3 +410,4 @@ callback.call(null, proxy._after[group].results);

index: index,
result: callback ? callback(data) : data
// callback(err, args1, args2, ...)
result: callback ? callback.apply(null, Array.prototype.slice.call(arguments, 1)) : data
});

@@ -422,2 +433,3 @@ };

debug('Add listenner for Any of events %j emit', events);
proxy.once(_eventName, callback);

@@ -427,2 +439,3 @@

proxy.bind(key, function (data) {
debug('One of events %j emited, execute the listenner');
proxy.trigger(_eventName, {"data": data, eventName: key});

@@ -444,4 +457,6 @@ });

var proxy = this;
debug('Add listenner for not event %s', eventName);
proxy.bind("all", function (name, data) {
if (name !== eventName) {
debug('listenner execute of event %s emit, but not event %s.', name, eventName);
callback(data);

@@ -448,0 +463,0 @@ }

10

package.json

@@ -16,5 +16,9 @@ {

],
"dependencies": {},
"dependencies": {
"debug": "0.7.2"
},
"devDependencies": {
"mocha": "*",
"mocha-phantomjs": "*",
"component": "*",
"blanket": "*",

@@ -34,3 +38,3 @@ "pedding": "*",

"travis-cov": {
"threshold": 70
"threshold": 97
}

@@ -42,3 +46,3 @@ },

},
"version": "0.2.5",
"version": "0.2.6",
"main": "index.js",

@@ -45,0 +49,0 @@ "directories": {

@@ -73,2 +73,9 @@ EventProxy [![Build Status](https://secure.travis-ci.org/JacksonTian/eventproxy.png)](http://travis-ci.org/JacksonTian/eventproxy) [![NPM version](https://badge.fury.io/js/eventproxy.png)](http://badge.fury.io/js/eventproxy) [English Doc](https://github.com/JacksonTian/eventproxy/blob/master/README_en.md)

```
### Component
```bash
$ component install JacksonTian/eventproxy
```
### 前端用户

@@ -517,1 +524,6 @@ 以下示例均指向Github的源文件地址,您也可以[下载源文件](https://raw.github.com/JacksonTian/eventproxy/master/lib/eventproxy.js)到你自己的项目中。整个文件注释全面,带注释和空行,一共约500行。为保证EventProxy的易嵌入,项目暂不提供压缩版。用户可以自行采用Uglify、YUI Compressor或Google Closure Complier进行压缩。

[The MIT License](https://github.com/JacksonTian/eventproxy/blob/master/MIT-License)。请自由享受开源。
## 捐赠
如果您觉得本模块对您有帮助,欢迎请作者一杯咖啡
[![捐赠EventProxy](https://img.alipay.com/sys/personalprod/style/mc/btn-index.png)](https://me.alipay.com/jacksontian)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc