Skip to content
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
@alxmyth

Description

@alxmyth

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions