This repository was archived by the owner on May 17, 2019. It is now read-only.
This repository was archived by the owner on May 17, 2019. It is now read-only.
Support async provides
in Fusion.js plugins #378
Open
Description
Type of issue
Feature request
Description
Support an async provides
method for Fusion.js plugins. These should be resolved prior to being passed in as dependencies to other plugins.
Current behavior
createPlugin({
deps: {},
provides: async (deps) => {
const service: SomeLibraryType = new SomeLibrary();
await service.init();
return service;
}
});
If the above plugin were used as a dependency, it would resolve to Promise<SomeLibraryType>
.
Expected behavior
Ideally consumers can use the underlying library directly, and dependents would have access to the underlying service:
createPlugin({
deps: { someLibrary: SomeLibraryToken },
provides: (deps) => {
const someLibrary: SomeLibraryType = deps.someLibrary; // not a Promise
}
}
Metadata
Metadata
Assignees
Labels
No labels