|
|
|
|
|
by quarterto
3841 days ago
|
|
If you don't mind setting the function on instances at construct time, you can use ES2016 class properties: class x {
a = wrapFunction(function() {})
}
This kind of use case is pretty well covered by ES2016 decorators as well (they're a bit more general as they act on property descriptors, not just values): class x {
@functionWrapper
a() {}
}
|
|