
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
light event library, support Node.js and Broswer.
Symbol type for bindscope parameterhttps://www.npmjs.com/package/EventFire
node test.js
or
var EventFire = require('./index')
// or ES6
// import EventFire from './index';
var e = new EventFire();
var dataFn = function(ev) {
console.log(ev.data)
console.log('event test of data parameter');
}
var offFn = function(ev) {
console.log('event test of off() function');
}
var objFn = function(ev) {
console.log('event test of ObjectBinding function');
}
e.once('event1', dataFn);
e.on('event2', offFn);
// ========== listeners Test ==========
console.log(e.listeners('event1'))
console.log(e.listeners('event2'))
// ========== listeners Test ==========
// ========== data Test ==========
e.fire('event1', {a: 111})
e.fire('event1')
// ========== data Test ==========
// ========== off Test ==========
e.fire('event2')
e.off('event2', offFn)
e.fire('event2')
// ========== off Test ==========
// ========== object Test ==========
e.on({eventObj: objFn})
e.fire('eventObj')
// ========== object Test ==========
// ========== regexp Test ==========
e.on(/^eventreg/, function(){
console.log('this is a regexp fn')
});
e.fire('eventregabc')
e.fire('eventreg123')
// ========== regexp Test ==========
// ========== offAll Test ==========
e.offAll()
e.fire('event1')
e.fire('event1')
e.fire('event2')
// ========== offAll Test ==========
// ========== Symbol Test ==========
var ee = new EventFire();
var sbl = Symbol('test'),
sblCnt = 0;
var sblFn = function(){
console.log('this is Symbol event test '+ ++sblCnt)
}
ee.on(sbl, sblFn)
ee.fire(sbl);
ee.off(sbl, sblFn);
ee.fire(sbl);
// ========== Symbol Test ==========
// ========== scope Test ==========
var es = new EventFire();
es.on('scope1', function(){
console.log(this.name)
},{'once': true, 'scope': {'name': 'scope test1'} });
es.fire('scope1');
es.fire('scope1');
es.once('scope2', function(){
console.log(this.name)
},{'scope': {'name': 'scope test2'} });
es.fire('scope2');
es.fire('scope2');
es.on({scopeObj: function(){
console.log(this)
}}, {'scope': {'name': 'scope objectFn test'} })
es.fire('scopeObj');
// ========== scope Test ==========
FAQs
A custom-event libary for Broswer & Node.js
The npm package EventFire receives a total of 3 weekly downloads. As such, EventFire popularity was classified as not popular.
We found that EventFire demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.