2.0.2 • Published 4 years ago

strikejs-app-service v2.0.2

Weekly downloads
15
License
ISC
Repository
github
Last release
4 years ago

strikejs-app-service

A recursive service registry that can be used as a dependency container in JavaScript applications.

Usage

import {AppService} from 'strikejs-app-service';

const registry = new AppService(); 

registry.set('someService', ()=>'some Value');

// notice that it returns a promise 
registry.get('someService').then(console.log);

// you can provie a function that returns a promise
// this is useful for code splitting 
registry.set('someOtherService', ()=>Promise.resolve('some Value'));

// or import a file using `import`
registry.set('someService', () => import('./test'))

registry.get('someOtherService').then(console.log);

// you can also access other dependencies
registry.set('someService', async (registry) => {
  const someOtherDependency = await registry.get('someOtherSerivce');
  return createMyService(someOtherDependency);
});
2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago