
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Convert objects into event emitters, that emit events before and after calling the specified methods.
Dependencies:
npm install eventize
The package is also available as a UMD module (compatible with AMD, CommonJS and exposing a global variable eventize) in dist/eventize.js and dist/eventize.min.js (1.9 KB minified and gzipped).
It can be installed with npm, bower or downloading the release from GitHub:
npm install eventize
bower install eventize
eventize.object converts plain objects into event emitters (if it they are not) and wraps the specified methods to emit events before and after being called:
var eventize = require('eventize');
var myObject = {
name: 'John',
getName: function() {
return this.name;
},
setName: function(name) {
this.name = name;
return name;
}
};
// equivalent to eventize.object(myObject, ['setName']);
eventize.object(myObject, ['setName']);
myObject.on('setName:before', function(args, method, target) {});
myObject.on('setName', function(args, returnValue, method, target) {});
myObject.setName('Jack'); // emits setName:before and setName
eventize.methods wraps the specified methods to emit events before and after being called (the target must be an event emitter):
var eventize = require('eventize');
var util = require('util');
var EventEmitter = require('util');
function MyConstructor() {
EventEmitter.call(this);
}
util.inherits(MyConstructor, EventEmitter);
MyConstructor.prototype.addOne = function(value) {
return value + 1;
};
eventize.methods(MyConstructor.prototype, ['addOne']);
var myObject = new MyConstructor();
myObject.on('addOne:before', function(args, method, target) {});
myObject.on('addOne', function(args, returnValue, method, target) {});
myObject.addOne(1); // Emits addOne:before and addOne
eventize.method wraps a single method to emit events (the target must be an event emitter):
eventize.method(myObject, 'getName');
myObject.on('getName:before', function(args, method, target) {});
myObject.on('getName', function(args, returnValue, method, target) {});
myObject.getName(); // emits setName:before and setName
To run the tests with Jasmine:
npm install
npm test
git checkout -b my-new-featuregit commit -am 'Add some feature'npm run buildgit push origin my-new-feature0.6.0:
0.5.1:
0.5.0:
0.4.0:
0.3.0:
eventize.methods (mostly for classes)0.2.0:
eventize.object and eventize.methodeventize (eventize.object) is now idempotent (as well as eventize.method)0.1.0:
The MIT License (MIT)
Copyright (c) 2015 Rubén Norte
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Make your methods emit events
The npm package eventize receives a total of 4 weekly downloads. As such, eventize popularity was classified as not popular.
We found that eventize 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.