Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Support async provides in Fusion.js plugins #378

Open
AlexMSmithCA opened this issue May 2, 2019 · 0 comments
Open

Support async provides in Fusion.js plugins #378

AlexMSmithCA opened this issue May 2, 2019 · 0 comments

Comments

@AlexMSmithCA
Copy link
Member

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
   }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant