Re:Show HN: ES7 Decorator library adds types checking, memoi...
by loganfsmyth on Sunday May 31, 2015 @12:36PM
(#9634636)
The main other benefit of decorators is that they work on property descriptors, and are automatically passed property names and the target object, so you have a bit more info.
Having the descriptor means for instance that you can switch a value to use a getter function, and that enables a bunch of interesting functionality that you couldn't otherwise do.
One example that I like is automatically binding methods to the current instance on first property access.
Having the descriptor means for instance that you can switch a value to use a getter function, and that enables a bunch of interesting functionality that you couldn't otherwise do.
One example that I like is automatically binding methods to the current instance on first property access.