+
Skip to content

@webext-core/proxy-service usage #102

@web3luhao

Description

@web3luhao

the default usage guide is

export const [registerMathService, getMathService] = defineProxyService(
  'MathService',
  () => new MathService(),
);

will make non-background part actually run new MathService() and invoke all its imports, should mention it, after all it non-background part do not need these code.
and have a alternative example, basically is two part

// background
export const [registerMathService,_] = defineProxyService(
  'MathService',
  () => new MathService(),
);
// non-background
export const [_, getBackgroundService] = defineProxyService(
  'MathService',
  // eslint-disable-next-line -- Proxied
  () => ({}) as IMathService,
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载