这是我的JSON
var nodeclienthash={
socket:null,
init : function() {
// initialize socket.io
this.socket = new io.Socket(this.config.host, {port: this.config.port, rememberTransport: false});
}
};
现在我想只创建两个对象,我该如何创建呢?
答案 0 :(得分:2)
function NodeClientHash() {
this.socket = null;
this.init = function() {
this.socket = new io.Socket(this.config.host, {port: this.congig.port, rememberTransport: false});
}
}
var client = new NodeClientHash();