Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Indispensable Module for loosely coupled applications
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
index.js
npm-debug.log
package.json
readme.md

readme.md

Linchpin

build status

Event Driven Application Architecture Module

This module creates a global instance of an EventEmitter that can be required by any module that would like to communicate with any other module in the application. This module provides the ability to create loosely coupled modules or event application architecture.

Event Application Architecture is the process of creating self contained modules that only communicate to other modules via messaging. This significantly reduces the rigid coupling that causes applications to become hard to test and manage.

Basic Usage

module1.js

var pin = require('linchpin');

pin.on('foo', function(d) { console.log('you called foo.'); });

module2.js

var pin = require('linchpin');

pin.emit('foo', 'bar');

main.js

require('module1');
require('module2');

exec

node main.js
#> You Called Foo

Wildcard Support

var pin = require('linchpin');
pin.on('foo/*', function () { console.log('you called foo xxx'); });
pin.on('foo/bar/*', function () { console.log('you called foo bar xxx'); });
pin.on('foo/bar/baz', function () { console.log('you called foo bar baz'); });

pin.emit('foo/bar/baz');

Install

npm install linchpin  --save

Tests

npm test

License

SEE LICENSE

How to contribute

  • Check out Open Issues
  • Post an Issue for a Feature
  • Submit a Pull Request (Please Include Test Case)

Credits

  • Ryan Dahl creator of nodejs and the whole nodejs team.
  • Addy Osman for his presentations videos
Something went wrong with that request. Please try again.