singelton-app
v1.0.1
Published
A very simple module to create a singelton application, which instance can be required from other modules in an application.
Downloads
4
Maintainers
Readme
singelton-app
With this very simple module you can create a singelton application instance (global application instance) that can be required/imported by other modules in the same application, so that they all share the same instance of the application module.
How to use
All you need to do is to require the singelton-app from your main module (for example app.js) and then extend it with your application functions:
app.js
var app = require('singelton-app');
app.extend({
initialize: function () {
console.log( 'initialize function' );
},
sayHello: function () {
console.log( 'Hello!' );
}
});
app.initialize();
Then you can access the extended functions of the singelton application from any project module with:
someModule.js
var app = require('singelton-app');
exports.someFunction = function() {
app.sayHello();
});