async_template_mixin.js 986 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * DevExtreme (ui/shared/async_template_mixin.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. module.exports = {
  11. _waitAsyncTemplates: function(callback) {
  12. if (this._options.templatesRenderAsynchronously) {
  13. this._asyncTemplatesTimers = this._asyncTemplatesTimers || [];
  14. var timer = setTimeout(function() {
  15. callback.call(this);
  16. clearTimeout(timer)
  17. }.bind(this));
  18. this._asyncTemplatesTimers.push(timer)
  19. } else {
  20. callback.call(this)
  21. }
  22. },
  23. _cleanAsyncTemplatesTimer: function() {
  24. var timers = this._asyncTemplatesTimers || [];
  25. for (var i = 0; i < timers.length; i++) {
  26. clearTimeout(timers[i])
  27. }
  28. delete this._asyncTemplatesTimers
  29. }
  30. };