This repository has been archived by the owner on Jun 8, 2023. It is now read-only.
Releases: noel-archive/Lilith
Releases Β· noel-archive/Lilith
4.0.1
4.0.0
Additions
- Subscriptions API π
- APIs for Components and Services π
Deprecations
Container.runInjections(target)
has been replaced withContainer.addInjections(target)
.
APIs for Components and Services: What is that?
It's just a external class named api
that has references to the container.
Subscriptions API: What is it?
It's a way to have methods emitted from component/service (or child!) components without external libraries or any implementation. You must register your emitter though or it'll not work! An example would be:
components/some-dummy.component.ts
import { Component, Subscribe } from '@augu/lilith';
@Component({ priority: 0, name: 'some-dummy' })
export default class MyDummyComponent {
@Subscribe('some-event', 'a-event-emitter', false)
onSomeEvent(a: string) {
console.log('received: ' + a);
}
}
main.ts
import { Container } from '@augu/lilith';
import { EventEmitter } from 'events';
const container = new Container({
componentsDir: 'find your components here :D'
});
const emitter = new EventEmitter();
container.addEmitter('a-event-emitter', emitter);
(async() => {
await container.load();
emitter.emit('some-event', 'uwudog');
})();