1.0.0 • Published 5 years ago
@itemsjs/app-context v1.0.0
ItemsJS application context
Wrap all your application-level services
Installation
npm i @itemsjs/app-context --save
Usage
const AppContext = require('@itemsjs/app-context');
const appContext = new AppContext();
// set your services here
appContext.service1 = (n) => n * 2; // simple multiply function as a service
// use your service(s)
let result = appContext.service1(2); // output: 4
// as you know, you can access javascript properties using string name
result = appContext['service1'](2); // output: 4 (same as the line above)
And you're good to go!
License
MIT
1.0.0
5 years ago