开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜