DelayedTask-min.js 622 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
  3. *
  4. * http://extjs.com/license
  5. */
  6. Ext.util.DelayedTask = function(E, D, A) {
  7. var G = null, F, B;
  8. var C = function() {
  9. var H = allGetServerTime().getTime();
  10. if (H - B >= F) {
  11. clearInterval(G);
  12. G = null;
  13. E.apply(D, A || [])
  14. }
  15. };
  16. this.delay = function(I, K, J, H) {
  17. if (G && I != F) {
  18. this.cancel()
  19. }
  20. F = I;
  21. B = allGetServerTime().getTime();
  22. E = K || E;
  23. D = J || D;
  24. A = H || A;
  25. if (!G) {
  26. G = setInterval(C, F)
  27. }
  28. };
  29. this.cancel = function() {
  30. if (G) {
  31. clearInterval(G);
  32. G = null
  33. }
  34. }
  35. };