core package
The heart of xoram.
View doc at https://xoram.dev.
Functions
Function | Description |
---|---|
Register a plugin into the active application after it has been initialized. | |
Register a plugin into the active application after it has been initialized. | |
Register a set of plugins into the active application after it has been initialized. | |
Register a set of plugins into the active application after it has been initialized. | |
Register a service the depends on another or on the application. | |
Register a self-contained service with no dependency. | |
Create an application from a set of plugins | |
Load a set of plugins in the application when a condition is met | |
Define an anonymous plugin using a generated id | |
Define a named plugin using a provided name. | |
Define a stateless service, also known as | |
Define a stateful service. | |
Mark the plugin as depending on the given dependency. | |
Tear down an application and it's plugins | |
Add a callback to be called between the dependency resolution and adding the plugins to the application | |
Add a callback to be called before the plugin is removed from the application | |
Add a callback to be called when the plugin is added to the application | |
Listen to multiple events from the same source at once and cleanly stop to listen when the plugin is disposed off. | |
Listen to all the events of a source at once and cleanly stop to listen when the plugin is disposed off. Only use this overload when you need to listen to all the events, if you need to listen to just a subset of the events consider passing an array of those events. | |
Listen to a specific event of a source and cleanly stop to listen when the plugin is disposed of. | |
Remove a plugin and all those depending on it in reverse topological order. | |
Remove a plugin and all those depending on it in reverse topological order. | |
(BETA) |
Interfaces
Interface | Description |
---|---|
An application instance as returned by `createApp`. | |
Optional configuration options for an application. | |
An instance of a plugin as returned by a `PluginDefinition`. | |
A factory function that returns a defined plugin ready to be added to an application. Created by calling definePlugin(setup) or definePlugin(id, setup) | |
The minimal requirement for a service. A service matching this interface precisely (i.e. without any other public member) is referred to as a | |
Register your service in this interface by augmenting it | |
Events that all `services` are subject to emit. |
Type Aliases
Type Alias | Description |
---|---|
Event's emitted by the Application's own event emitter. | |
Plugin related hooks emitted by the application. | |
The payload of an event emitted by the application as part of a plugin's life cycle. | |
Service related hooks emitted by the application. | |
An idempotent cleanup function returned by | |
A direct emitter. | |
An object holding an emitter, usually an application instance or service instance | |
A function returning a direct emitter or an object holding an emitter. The application passed as parameter is the current application context | |
A plugin's unique identifier. ⚠️ Do not mistake this with definePlugin | |
Describes how a plugin is created. | |
Prettify types. Shamelessly stolen from https://timdeschryver.dev/bits/pretty-typescript-types | |
Build and return a service object, the provided app can be used to access already registered services or to listen to ApplicationHooks. | |