Javascript ';净';拒绝排放';关闭';nodejs中的事件
嗨,我有以下代码:Javascript ';净';拒绝排放';关闭';nodejs中的事件,javascript,node.js,Javascript,Node.js,嗨,我有以下代码: this.stop = function() { this.server.close(); var thisServer = this; this.server.on('close',function() { thisServer.emit('stop'); }); }; 使用服务器并调用stop函数后,服务器拒绝 要发出“关闭”事件,请执行以下操作: this.server.on('clos
this.stop = function() {
this.server.close();
var thisServer = this;
this.server.on('close',function() {
thisServer.emit('stop');
});
};
使用服务器并调用stop函数后,服务器拒绝
要发出“关闭”事件,请执行以下操作:
this.server.on('close',function() {
thisServer.emit('stop');
});
我做错什么了吗
this.server.on('close',function() {
thisServer.emit('stop');
});
this.server.close();
var thisServer = this;
在调用close之前绑定close事件
或者尝试this.server.destroy()代码>