jayphelps / core-decorators

Library of stage-0 JavaScript decorators (aka ES2016/ES7 decorators but not accurate) inspired by languages that come with built-ins like @​override, @​deprecate, @​autobind, @​mixin and more. Popular with React/Angular, but is framework agnostic.
MIT License
4.52k stars 263 forks source link

Explain applyDecorators() for a function prototype #150

Open jslz opened 6 years ago

jslz commented 6 years ago

hi, any chance somebody has example code for how to use applyDecorators() on a non-class-method stand-alone kind of function? I don't know what key to use for the property.

The docs only say:

// This works on regular function prototypes
// too, like `function Foo() {}`
applyDecorators(Foo, {
  getFoo: [autobind]
});