From 2f744950f8a60cd4c3cac59e1b7f7fc6957a6592 Mon Sep 17 00:00:00 2001 From: User756675678 <53032556+User756675678@users.noreply.github.com> Date: Fri, 6 Mar 2020 14:38:07 +0200 Subject: [PATCH] Update tiny-autocomplete.js Do not need use ES6 features. --- src/tiny-autocomplete.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tiny-autocomplete.js b/src/tiny-autocomplete.js index 52fd25d..7eda4ff 100644 --- a/src/tiny-autocomplete.js +++ b/src/tiny-autocomplete.js @@ -151,20 +151,20 @@ var factory = function($, window) { ); this.el.on("blur", ".autocomplete-field", $.proxy(this.closeList, this)); - + var self = this; // Update maxItems when window size change $(window).resize( - this.debounce(() => { + this.debounce(function() { if ( - window.innerWidth < this.settings.mobileWidth && - this.settings.maxItemsOnMobile !== null + window.innerWidth < self.settings.mobileWidth && + self.settings.maxItemsOnMobile !== null ) { - this.settings.maxItems = Math.min( - this.settings.maxItems, - this.settings.maxItemsOnMobile + self.settings.maxItems = Math.min( + self.settings.maxItems, + self.settings.maxItemsOnMobile ); } else { - this.settings.maxItems = this.settings.maxItemsOnLarge; + self.settings.maxItems = self.settings.maxItemsOnLarge; } }, 250) );