babel-plugin-class-autobind
Please note that this will add implicit magic to your code
This plugin will autobind all handlers for components listed in directive '@autobind'
prefixes = on, _on, handle, _handle
;
Example
In
'@autobind Component'; { } {} {} {} // @autobind-ignore {}
Out
{ thishandleMe = thishandleMe; thisonMe = thisonMe; } {} {} {} {}
Installation
$ npm install babel-plugin-class-autobind
Options
if no components are listed in directive - all handlers in file classes will be bound to class instance. (equal to @autobind *
)
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel --plugins class-autobind script.js
Via Node API
;