Skip to content
New issue

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

Calling the same function with same argument however it's still not equal #16

Open
undefined-moe opened this issue Oct 1, 2024 · 1 comment

Comments

@undefined-moe
Copy link

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
    },
});
@shigma
Copy link
Member

shigma commented Nov 9, 2024

已修复此问题,将在下个大版本实装。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants