moduleHelper
JavaScript module namespacer and event emitter
Usage
For apps using singletons which needs to be globally available but depending on other singletons inside application
For example displaying username after user had logged in:
// simple function saying hello to given user { console;} // class (defined using ES6 syntax) which needs to be instantiated after user had logged in { app; } // class extending moduleHelpers built in event emitterEventEmitter { this; } { thisusername = "johnDoe"; this; }
Instantiate singleton
// create "new SayHello()" and bind it in "app.sayHello"moduleHelper; // create "new User()" and bind it in "app.user" // after app.sayHello is initializedmoduleHelper; // create "new Welcome()" and bind it in app.welcome// after DOM is ready// after app.sayHello is initialized// after app.user is initialized and triggered "login" eventmoduleHelper;
Building
For now, to be able to build minified file, you need to have "babel", "browserify" and "uglifyjs" installed globaly (this should be changed in the near future)