We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { Context, Service } from 'cordis'; declare module 'cordis' { interface Context { foo: FooService; } } const app = new Context(); class FooService extends Service { registry = { }; constructor(ctx) { super(ctx, 'foo', true); } register(name, value) { if (this.registry[name] && this.registry[name] !== value) throw new Error(); this.registry[name] = value; } } app.plugin(FooService); app.plugin({ inject: ['foo'], apply(ctx) { function bar() { } ctx.foo.register('example', bar); // ok ctx.foo.register('example', bar); // throws }, });
The text was updated successfully, but these errors were encountered:
已修复此问题,将在下个大版本实装。
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: