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

biojs-events

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

biojs-events - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.npmignore

17

index.js
var events = require("backbone-events-standalone");
events.onAll = function(callback,context){
this.on("all", callback,context);
return this;
};
// Mixin utility
events.mixin = function(proto) {
var exports = ['on', 'once', 'off', 'trigger', 'onAll', 'stopListening', 'listenTo',
'listenToOnce', 'bind', 'unbind'];
for(var i=0; i < exports.length;i++){
var name = exports[i];
proto[name] = this[name];
}
return proto;
};
module.exports = events;

15

package.json
{
"name": "biojs-events",
"version": "0.0.2",
"version": "0.0.3",
"description": "BioJS event system",

@@ -25,3 +25,14 @@ "main": "index.js",

"backbone-events-standalone": "^0.2.2"
}
},
"devDependencies": {
"mocha": "1.8.x",
"chai": "1.5.x",
"jshint": "2.x",
"underscore": "1.4.x",
"grunt": "0.4.x",
"grunt-contrib-uglify": "0.2.x"
},
"scripts": {
"test": "mocha"
}
}
new event system
event system
------------------
This is a convenience wrapper for the [Event system](https://github.com/biojs/biojs2/wiki/Event-systems).
You can choose any library that supports the choosen syntax.
This wrapper here is for [`backbone-events-standalone`](https://www.npmjs.org/package/backbone-events-standalone) and thus the Backbone event system.
How to use
----------
### 1. install
```
npm install biojs-events --save
```
### 2. Mix the events capability with your object
After the code of your BioJS component add the events capability by mixing you component object with the events:
```
require('biojs-events').mixin(my_component);
```
### 3. Trigger events
Now in your code you can use the events methods (trigger, off,on,once):
```
self.trigger('onSomethingChanged', {
data : "some data to include in your event"
});
```
.gitgnore
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