Problem
As you see, too many .bind()
operations in constructor. Once you have tons of classes
are called in callback or whatever something change it's scope, it will be horribly troublesome.
{ thisname = 'Steve' thisage = 20 thisgender = 'male' thissetName = thissetName thissetAge = thissetAge thissetGender = thissetGender } { thisname = name } { thisage = age } { thisgender = gender }
Easy Way
Bind all methods in constructor.
{ thisname = 'Jack' thisage = 20 thisgender = 'male' } { thisname = name } { thisage = age } { thisgender = gender }
Or you can bind specified methods in constructor depend on your situation.
Install
yarn add es6-class-bind-all --dev
or npm
npm install es6-class-bind-all --save-dev
License
The MIT License (MIT). Please see License File for more information.