我正在编写一个nodejs类以与modesl一起使用(freswitch事件模块)
'use strict';
const esl = require('modesl');
class eslClass {
connect() {
this.fswcon = new esl.Connection(config.fswEslHost, config.fswEslPort, 'ClueCon', () => {
this._listen();
});
}
}
// connect() will failed with a 'this.once' is undefined ( .once is coming from eventEmitter2, i believe )
我必须“克隆”对象以取消错误
const eslClone = esl.Connection;
class eslClass {
connect() {
this.fswcon = new eslClone (config.fswEslHost, config.fswEslPort, 'ClueCon', () => {
this._listen();
});
}
}
// error is gone away !!