A simple event observer with vanilla JavaScript for the event communication of different JavaScript Layers. Maybe it is helpful for a MVC software architecture.
npm install mypluralize --save
var EventObserver = require('EventObserver');
var eventObserver = new EventObserver();
eventObserver.subscribe(() => {
console.log('do some stuff');
});
eventObserver.emit();
Output should be 'do some stuff'
import { EventObserver } from 'EventObserver';
var eventObserver: EventObserver = new EventObserver();
eventObserver.subscribe(() => {
console.log('do some stuff');
});
eventObserver.emit();
Output should be 'do some stuff'
define(function(require,exports,module){
var pluralise = require('mypluralize');
});
You can just use your favorite CJS bundler. If you have no favorite yet? Maybe you can try: Browserify or Webpack
npm run test