lockmethod
v0.0.6
Published
lock method for node.js
Downloads
8
Readme
lock method for node.js
var lockMethod = require('lockMethod');
var time = 3000;
var obj = { changeState : lockMethod(
function(state,cb){
setTimeout(function(){
cb(state+time)
},time)
time -= 300;
}
)
}
obj.changeState('a',function(r){console.log(r);});
obj.changeState('b',function(r){console.log(r);});
obj.changeState('c',function(r){console.log(r);});
result is >>>
a2700
b2400
c2100
IF:
var obj = { changeState :
function(state,cb){
setTimeout(function(){
cb(state+time)
},time)
time -= 300;
}
}
Then result is >>>
c2100
b2100
a2100