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

Autobind not working with inheritance #81

Closed
newduke opened this issue Dec 12, 2018 · 3 comments
Closed

Autobind not working with inheritance #81

newduke opened this issue Dec 12, 2018 · 3 comments

Comments

@newduke
Copy link

newduke commented Dec 12, 2018

In the following example, executing the autobound function removes the overridden method. Executing it again will no longer call the overridden function, and only call the base class.

window.A = class A {
    regular() {
        console.log("A.regular");
    }
    @autobind autobound() {
        console.log("A.autobound");
    }
};
window.B = class B extends window.A {
    regular() {
        console.log("B.regular");
        super.regular();
    }
    autobound() {
        console.log("B.autobound");
        super.autobound();
    }
};
window.a = new window.A();
window.b = new window.B();
b.regular();b.regular(); // B.regular A.regular B.regular A.regular 
b.autobound();b.autobound(); // B.autobound A.autobound A.autobound 

This is using version 2.4.0

@stevemao
Copy link
Collaborator

Can you try #79 and see if it fixes your issue?

@newduke
Copy link
Author

newduke commented Dec 15, 2018

@stevemao #79 fixes this issue.

@stevemao
Copy link
Collaborator

continue the discussion there

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

No branches or pull requests

2 participants