developit / developit/decko

@bind decorator bug when super method is called

未关闭
#12 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
1k
派生
34
PR 合并指标
30 天内没有已合并 PR

描述

This snippet demonstrates that the `bind` decorator does not work correctly on second method call if that method invokes super method which in turn is also decorated:
```javascript
class A {
@bind
f() {
console.log('I\'m A.f');
}
}

class B extends A {
@bind
f() {
console.log('I\'m B.f BEGIN');
super.f();
console.log('I\'m B.f END');
}
}

let b = new B();
console.log('call b.f() 1st time:');
b.f();
console.log('call b.f() 2nd time:');
b.f();
```
Output:
```
call b.f() 1st time:
I'm B.f BEGIN
I'm A.f
I'm B.f END
call b.f() 2nd time:
I'm A.f
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。