J
Size: a a a
J
CM
IK
CM
J
CM
D
let value = await this.connection.connect()
this.connection.connect() is not a function
J
MS
D
CM
DE
this.name says this.voice
, к примеру.const myEmitter = new EventEmitter();2) Добавить аргумент контекста в коллбек
const rayTheCat = new Cat('Ray', 'Meow!');
let callback = function () {
console.log(`The ${this.name} says ${this.voice}`);
};
myEmitter.on('voice', callback.bind(rayTheCat));
rayTheCat.doVoice();
let callback = function (context) {
return () => console.log(`The ${context.name} says ${context.voice}`);
};
myEmitter.on('voice', callback(rayTheCat));
DE
DE
DE
d
this.name says this.voice
, к примеру.const myEmitter = new EventEmitter();2) Добавить аргумент контекста в коллбек
const rayTheCat = new Cat('Ray', 'Meow!');
let callback = function () {
console.log(`The ${this.name} says ${this.voice}`);
};
myEmitter.on('voice', callback.bind(rayTheCat));
rayTheCat.doVoice();
let callback = function (context) {
return () => console.log(`The ${context.name} says ${context.voice}`);
};
myEmitter.on('voice', callback(rayTheCat));
DE
DE
DE
DE