JSFiddle - React, Tailwind, and code Playground
by codemeasandwich
JavaScript
var mixpanelKeywordChangeTimer = null;
var search_changed = function(from){
var mixpanelValues = {
time : new Date(),
filter: from
};
if("keyword" === from){
if(mixpanelKeywordChangeTimer){
clearTimeout(mixpanelKeywordChangeTimer);
}
mixpanelKeywordChangeTimer = setTimeout(function(){
console.log('apply library filter', mixpanelValues);
}, 2000);
} else {
console.log('apply library filter', mixpanelValues);
} // END else
};