小程序如何解决原型函数调用问题
var TeamTalkWebClient = function(config) {
this.websocketUrl = config.wsurl;
this.clientState = UserStatType.USER_STATUS_OFFLINE;
this.logined = false;
this.connect();
};
/**
* @description connet to server
*/
TeamTalkWebClient.prototype.connect = function() {
if(!!this.websocket) {
this.websocket.close();
}
this.websocket = new WebSocket(this.websocketUrl);
bindWebsocketForClinet(this.websocket,this);
};
对于原型函数的定义,如何调用,用this.connect调用不了