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

function toString() and inspect not working properly #14

Closed
undefined-moe opened this issue Aug 10, 2024 · 0 comments
Closed

function toString() and inspect not working properly #14

undefined-moe opened this issue Aug 10, 2024 · 0 comments

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 {
    constructor(ctx) {
        super(ctx, 'foo', true);
    }

    funcA(arg) {
        console.log(arg, arg.toString());
        this.funcB(arg);
    }

    funcB(arg) {
        console.log(arg, arg.toString());
    }
}

app.plugin(FooService);
app.plugin({
    inject: ['foo'],
    apply(ctx) {
        ctx.foo.funcA(class Foo { });
    },
});
node -r @hydrooj/register foo.ts

outputs:

[class Foo] function () { [native code] }
[Function: Foo] function () { [native code] }
@shigma shigma closed this as completed in f58c078 Aug 11, 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

1 participant