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

es6里面,class的定义会导致涵数遍历不出来,然后proxy没用了 #30

Open
Daley opened this issue May 27, 2017 · 3 comments

Comments

@Daley
Copy link

Daley commented May 27, 2017

class ChatRemote {
        test() {
        }
        aa = "1";
}
var chat = new ChatRemote();
for(var n in chat){
        console.log("ff",n);
}

test涵数,用for in 遍历不出

@429365799
Copy link

实在不想写prototype,最后在constructor里面手动注册了方法。。。。。

@mybios
Copy link

mybios commented Jan 10, 2018

可以关注下pomelo的typescript实现,完美解决了你遇到的问题。
Pinus Github传送门

@r5libs
Copy link

r5libs commented Jan 18, 2019

需要将类的函式都设定enumerable为true.
这部分可以先写好es6 class, 再写一个辅助函式将类的每个函式添加enumerable为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

4 participants