Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aisle

Build Status Dependency Status

Module for global event handling and namespacing.

$ npm install aisle

Usage

Programmatically

var aisle = require("aisle");

Call your aisle for namespaces or use it as you would an EventEmitter object.

Namespaces

If you call aisle without any arguments, then aisle will tap into and return require.main.exports, otherwise aisle will return your namespace and its data. If you provide data with your namespace, then aisle will assign that data to your namespace (namespaces will be created or overwritten.)

// main.js
var aisle = require("aisle");

module.exports = {"data": "main"};

aisle("my-namespace",{"abc": 123});

require("./other");
// other.js
var aisle = require("aisle");

console.log(aisle()); // { data: 'main' }
console.log(aisle("my-namespace")); // { abc: 123 }
console.log(aisle("nonexistent-namespace")); // undefined

Events

With your Node's version, use Node's documentation to find its EventEmitter abilities.

// main.js
var aisle = require("aisle");

aisle.on("some global event",console.log); // { data: [ 'here', true ] }

require("./other");
// other.js
var aisle = require("aisle");

aisle.emit("some global event",{"data": ["here",true]});

About

Module for global event handling and namespacing.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages