This package has been deprecated

Author message:

Obsolete

vnls-event

0.0.2 • Public • Published

vnls-event

Cross platform Eventemitter. In Nodejs de Nodejs Eventemmiter is used, on the browser side a reverse engineered Eventemitter is used.

Install:

Nodejs:

On node nodejs

npm install vnls
npm install vnls-event

Then, somewhere at the top of your code

require('vnls');
require('vnls-event');

There is no need to bind it to a var because var VNLS is made global to the nodejs process so it's behavior is exactly like in a browser environment. All-though this IS a kind of pollution on nodejs.

Browser

In a browser (you may also download the file first):

 <script type="text/javascript" src="https://raw.githubusercontent.com/jorritd/vnls/master/lib/vnls.min.js"></script>
 <script type="text/javascript" src="https://raw.githubusercontent.com/jorritd/vnls-event/master/lib/vnls-event.min.js"></script>

Usage:

var emitter = VNLS.getObject('event','EventEmitter');
emitter.addListener("test_event",function(){
    // Do something
});

or:

var emitter = VNLS.getObject('event','EventEmitter');
emitter.on("test_event",function(a,b,c){
  // Do something
  emitter.removeAllListeners("test_event");
});
emitter.emit("test_event",'a','b','c');

Dependencies:

vnls

Development:

  • jasmine-node Testing npm install jasmine-node
  • nodewatch Autotesting TDD npm install nodewatch
  • uglify-js Building npm install uglify-js
  • jake rake, make, ant substitute (Java-script all the way) npm install -g jake

For jake these are the commands:

  • jake compress : build minified version in './lib/*'
  • jake test : run the specs
  • jake autotest : run the specs on a filechange for TDD

For testing in a browser environment just point your browser to 'specs/index.html'. It should run the same specs as jake test does. (The tests cover both browser and server)

Package Sidebar

Install

npm i vnls-event

Weekly Downloads

4

Version

0.0.2

License

none

Last publish

Collaborators

  • jorrit