August 2017
Beginner
374 pages
10h 41m
English
Next, we define the run method, which takes a function as an argument. This function will be called after the middleware function finishes running:
run (fn) {
this.middleware(
() => fn.call(this) ) }
Every non-arrow function (this includes the function and class definitions) has its own this context. Arrow functions, however, can access the this context from the upper scope, meaning that they inherit the this context from the parent scope (defined by { } brackets).
Up to now, we have not dealt with this context ...
Read now
Unlock full access