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

instanceof does not work for jsface #20

Closed
seanzhou321 opened this issue Aug 1, 2014 · 2 comments
Closed

instanceof does not work for jsface #20

seanzhou321 opened this issue Aug 1, 2014 · 2 comments

Comments

@seanzhou321
Copy link

Hi, jsface is very nice given its speed and simplicity. I only found one issue that instanceof is broken for classes created by jsface. Besides of fixing instanceof, I have one wish to have instanceof also works for mixins, which acts as interfaces. Thanks.

@tnhu
Copy link
Owner

tnhu commented Aug 4, 2014

Thank you for reporting. It'd be helpful if you could paste some samples?

@seanzhou321
Copy link
Author

var jf = require('jsface');

var Parent = jf.Class({
name: 'Parent'
});

var Parent2mix = jf.Class({
mixMe: function() {console.log('mixme.');}
});

var Child = jf.Class([Parent, Parent2mix], {
childAction: function() { console.log('child Action.');}
});

var aChild = new Child();

console.log('instanceof Parent?', aChild instanceof Parent);
console.log('instanceof Parent2mix?', aChild instanceof Parent2mix);


The results returned are all false, which both should be true.

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