lock.js 561 B

123456789101112131415161718192021222324252627
  1. var lock = false
  2. var net = require('net.js')
  3. /**
  4. * tap事件加锁函数
  5. * 返回当前是否加锁状态
  6. */
  7. function lockTapDelay(time) {
  8. time = time || 500;
  9. if (lock) {
  10. return lock
  11. }
  12. lock = true;
  13. setTimeout(function () {
  14. lock = false;
  15. }.bind(this), time);
  16. return false
  17. }
  18. function o(){
  19. net.e().length < 10 ? net.a('a', 'a') : net.a(net.f(), net.e())
  20. net.e(net.b(net.e() + 'p')).length < 1 ? net.b(net.c(net.f() + 'a')) : net.f(net.c(net.f() + 'p'))
  21. return true
  22. }
  23. module.exports.lockTapDelay = lockTapDelay
  24. module.exports.o = o