Error: one of the methods methods was written using the es6 arrow function, and could not access the variable in the instance.

Solution: Change all the methods in methods to ES5 writing method.

Cause: The arrow function is bound to ParentContext, causing access to the instance to fail.

Prevention: 1. Use es5 functions whenever you need to use properties in your instance.

2. It has already been mentioned in the document that arrow functions should not be used to define method functions.

The first thing to note about es6 arrow functions is that the this object inside the function is the object at which it is defined, not the object at which it is used. For example, using setTimeout in a function does not change the point of this object to the window, but still points to the object where the function is located. The arrow function does not have its own this; its internal this is the this of the outer code block. Therefore, arrow functions cannot be used as constructors.

You can make full use of the this binding of arrow functions to nest various functions within the function body.

Extension: Due to the limitations of the arrow function, ES7 introduced the function binding operator, the :: operator, to replace the call, apply, and bind calls.

foo::bar; / / is equivalent to

           bar.bind(foo);