|
102 | 102 | that.badQueries = [];
|
103 | 103 | that.selectedIndex = -1;
|
104 | 104 | that.currentValue = that.element.value;
|
105 |
| - that.intervalId = 0; |
| 105 | + that.timeoutId = null; |
106 | 106 | that.cachedResponse = {};
|
107 |
| - that.onChangeInterval = null; |
| 107 | + that.onChangeTimeout = null; |
108 | 108 | that.onChange = null;
|
109 | 109 | that.isLocal = false;
|
110 | 110 | that.suggestionsContainer = null;
|
|
276 | 276 | disable: function () {
|
277 | 277 | var that = this;
|
278 | 278 | that.disabled = true;
|
279 |
| - clearInterval(that.onChangeInterval); |
| 279 | + clearTimeout(that.onChangeTimeout); |
280 | 280 | that.abortAjax();
|
281 | 281 | },
|
282 | 282 |
|
|
357 | 357 | killSuggestions: function () {
|
358 | 358 | var that = this;
|
359 | 359 | that.stopKillSuggestions();
|
360 |
| - that.intervalId = window.setInterval(function () { |
| 360 | + that.timeoutId = setTimeout(function () { |
361 | 361 | if (that.visible) {
|
362 | 362 | // No need to restore value when
|
363 | 363 | // preserveInput === true,
|
|
374 | 374 | },
|
375 | 375 |
|
376 | 376 | stopKillSuggestions: function () {
|
377 |
| - window.clearInterval(this.intervalId); |
| 377 | + clearTimeout(this.timeoutId); |
378 | 378 | },
|
379 | 379 |
|
380 | 380 | isCursorAtEnd: function () {
|
|
467 | 467 | return;
|
468 | 468 | }
|
469 | 469 |
|
470 |
| - clearInterval(that.onChangeInterval); |
| 470 | + clearTimeout(that.onChangeTimeout); |
471 | 471 |
|
472 | 472 | if (that.currentValue !== that.el.val()) {
|
473 | 473 | that.findBestHint();
|
474 | 474 | if (that.options.deferRequestBy > 0) {
|
475 | 475 | // Defer lookup in case when value changes very quickly:
|
476 |
| - that.onChangeInterval = setInterval(function () { |
| 476 | + that.onChangeTimeout = setTimeout(function () { |
477 | 477 | that.onValueChange();
|
478 | 478 | }, that.options.deferRequestBy);
|
479 | 479 | } else {
|
|
493 | 493 | (options.onInvalidateSelection || $.noop).call(that.element);
|
494 | 494 | }
|
495 | 495 |
|
496 |
| - clearInterval(that.onChangeInterval); |
| 496 | + clearTimeout(that.onChangeTimeout); |
497 | 497 | that.currentValue = value;
|
498 | 498 | that.selectedIndex = -1;
|
499 | 499 |
|
|
640 | 640 |
|
641 | 641 | that.visible = false;
|
642 | 642 | that.selectedIndex = -1;
|
643 |
| - clearInterval(that.onChangeInterval); |
| 643 | + clearTimeout(that.onChangeTimeout); |
644 | 644 | $(that.suggestionsContainer).hide();
|
645 | 645 | that.signalHint(null);
|
646 | 646 | },
|
|
0 commit comments