ES6 Class Auto Bind
A helpful ES6 base class that auto-binds methods to instances. You can restrict the auto-binding to a regular expression and control the next base class in the inheritance chain.
{ thisname = name } { return thisname } let o = "foo"let f = ftoStringconsole
Maybe you only want to auto bind event handlers based on onEvent
type method names?
/^on[A-Z]*$/ { console }
Of course, you might already have a class you need to inherit from. AutoBind lets you control what class it inherits from, but its auto-binding behavior will only apply to your class.
/^on[A-Z]*$/ ReactComponent { superprops } { return <div>Copyright © 2016</div> } { console }