NetEase / pomelo-cocos2d-js

pomelo-cocos2d-js client
100 stars 64 forks source link

setTimeout: cc use second , pomelo reconnect use milisecond #2

Open changhaohao opened 10 years ago

changhaohao commented 10 years ago

it will be ok if pomelo accept reconnectionDelay param

fantasyni commented 10 years ago

where to add this param?

changhaohao commented 10 years ago

inside pomelo-client.js the current reconnect not work because " var reconnectionDelay = 5000;" will make it wait 5000 seconds; i add a _0.001 to index.js var setTimeout = function(fn, interval) { var instance = cc.Director.getInstance(); var scene = instance.getRunningScene(); cc.log("setTimeout "+scene+" "+interval); instance.getScheduler(). scheduleCallbackForTarget(scene, fn, interval_0.001, 1, 0, false); return scene; }

//also reconnectionDelay can be passed as a param pomelo.init = function(params, cb) { reconnectionDelay =params.reconnectionDelay || 5000; }