This commit is contained in:
@@ -39,9 +39,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//NOTE: have to import lodash directly here as no combination was working with the window.$gz._
|
|
||||||
//it would not recognize window in the function call cache-items
|
|
||||||
import _ from "../libs/lodash.min.js";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
@@ -283,11 +281,11 @@ export default {
|
|||||||
vm.fetching = false;
|
vm.fetching = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doSearch: _.debounce(function(searchFor) {
|
doSearch: debounce(function(searchFor) {
|
||||||
//NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly
|
//NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly
|
||||||
//https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
|
//https://vuejs.org/v2/guide/migration.html#debounce-Param-Attribute-for-v-model-removed
|
||||||
//-----------------
|
//-----------------
|
||||||
|
console.log("doSearch debounced",searchFor);
|
||||||
let vm = this;
|
let vm = this;
|
||||||
let isATwoTermQuery = false;
|
let isATwoTermQuery = false;
|
||||||
let queryTerms = [];
|
let queryTerms = [];
|
||||||
@@ -372,4 +370,18 @@ export default {
|
|||||||
}, 300) //did some checking, 200-300ms seems to be the most common debounce time for ajax search queries
|
}, 300) //did some checking, 200-300ms seems to be the most common debounce time for ajax search queries
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_debounce
|
||||||
|
function debounce(func, wait, immediate) {
|
||||||
|
var timeout;
|
||||||
|
return function() {
|
||||||
|
var context = this, args = arguments;
|
||||||
|
clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(function() {
|
||||||
|
timeout = null;
|
||||||
|
if (!immediate) func.apply(context, args);
|
||||||
|
}, wait);
|
||||||
|
if (immediate && !timeout) func.apply(context, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import NProgress from "nprogress";
|
|||||||
import "nprogress/nprogress.css";
|
import "nprogress/nprogress.css";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import VueCurrencyInput from "vue-currency-input";
|
import VueCurrencyInput from "vue-currency-input";
|
||||||
import lodash from "./libs/lodash.min.js";
|
|
||||||
|
|
||||||
//my libs
|
//my libs
|
||||||
import errorhandler from "./api/errorhandler";
|
import errorhandler from "./api/errorhandler";
|
||||||
@@ -85,7 +84,6 @@ window.$gz = {
|
|||||||
dialog: gzdialog,
|
dialog: gzdialog,
|
||||||
util: gzutil,
|
util: gzutil,
|
||||||
DateTime: DateTime,
|
DateTime: DateTime,
|
||||||
_: lodash,
|
|
||||||
api: gzapi,
|
api: gzapi,
|
||||||
form: gzform,
|
form: gzform,
|
||||||
errorHandler: errorhandler,
|
errorHandler: errorhandler,
|
||||||
|
|||||||
Reference in New Issue
Block a user