Cross-cut your concerns with published authority.
publisher.js is a sophisticated mix of publish/subscribe (pub/sub) and
Aspect-Oriented Programming that facilitates autonomous JavaScript module
development.
In other words, your modules don't have to know about other modules, or the
application, or even the publisher object--they can be 100% self-contained.
The publisher object handles all of the cross-cutting concerns, connecting
your objects together.
publisher works as an AMD (RequireJS) module, a Node.js module, or a plain
object. If neither AMD nor Node.js environments are detected, the publisher
object is assigned to common global objects like ender, jQuery, $, and
finally to window if nothing else is available.
Place publisher.js in your application and require it as usual.
require(['path/to/publisher'], function (publisher) {
/* Do stuff with publisher here */
});Install with npm
npm install publisher
Include like everything else
var publisher = require('publisher');If ender, jQuery, or $ are defined, publisher is assigned to it--otherwise it hangs from the global object (window).
ender.publisher
jQuery.publisher
$.publisher
publisherCopyright (c) Ryan Florence
MIT-Style License
Fork, create a topic branch, send a pull request :D
While publisher has no dependencies, developing it does.
You'll need to install some stuff to run the tests and generate docs. There's
a script in bin to help. First make sure you've got Node.js, npm, and
Python installed, then simply run from the repository root:
$ ./bin/setup-dev
$ ./bin/run-tests
# or
$ tap test/test.js
$ ./bin/generate-docs