开发者

How to convert a JSON to work as Class for creating object

开发者 https://www.devze.com 2023-03-27 07:31 出处:网络
Here is my JSON var nodeclienthash={ socket:null, init : function() { // initialize socket.io this.socket = 开发者_开发问答new io.Socket(this.config.host, {port: this.config.port, rememberTransport:

Here is my JSON

var nodeclienthash={
  socket:null,
  init : function() {
    // initialize socket.io
    this.socket = 开发者_开发问答new io.Socket(this.config.host, {port: this.config.port, rememberTransport: false});
 }
};

For now i want to create only two object , how should i create that ?


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消