📜  延迟输入javascript代码示例

📅  最后修改于: 2022-03-11 15:02:40.194000             🧑  作者: Mango

代码示例1
let delayTimer;
function doSearch(text) {
    clearTimeout(delayTimer);
    delayTimer = setTimeout(function() {
        // Do the ajax stuff
    }, 1000); // Will do the ajax stuff after 1000 ms, or 1 s
}