Open jisaacks opened 7 years ago
Disclaimer: Not one of the maintainers/authors. But I think I can answer some of the questions.
extras
allows to explode one property into multiple properties. Example: Generate default getX
and setX
accessor methods for a private property.
finished
allows to operate on the 100% definitely final class reference. E.g. if I'd want to store meta data about the class, keyed by the class (myWeakMap.set(TheClass, metaData)
), I would run into problems if there's a class decorator that might wrap the original class. By running such code in the finisher
, I can be certain that future attempts of looking up the meta data will succeed.
This proposal is still in development; I'd be hesitant to publish a hard-copy book about its details. The answers have actually changed since the time you wrote these questions. I'll get back to you with current answers soon.
I am in the process of writing a book for Manning Publications on the newest JavaScript features, including future features that are in popular use (such as decorators)
I have some questions from the current stage-2 proposal that I would greatly appreciate if I could get answered so that I may provide the latest accurate information in my book.
It seems like class decorator function takes 3 arguments, the class/constructor being decorated, the parent class/constructor, an array of member descriptors.
Object
,null
,undefined
or something else?The member decorator functions accept and return member descriptors.
kind
may be "Property", I am assuming "Method" and "Accessor" are other possibilities. Does case matter? Any others?key
refers to the name of the member, and thus can be changed like so:extras
is an optional array of member descriptors. What is the purpose of this?finished
is an optional function, what is the purpose of this?Thanks so much.