Last active
December 21, 2022 01:27
-
-
Save ghostcode/65b0f7455d48e2375650cc114e13e7c4 to your computer and use it in GitHub Desktop.
Revisions
-
ghostcode revised this gist
Dec 21, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,5 @@ },wait) } } } ``` -
ghostcode revised this gist
Dec 21, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ``` function throttle(fn,wait=3000){ let lastTime = Date.now(), timeFlag = null -
ghostcode revised this gist
Dec 21, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ·· function throttle(fn,wait=3000){ let lastTime = Date.now(), timeFlag = null -
ghostcode revised this gist
Dec 21, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ function throttle(fn,wait=3000){ let lastTime = Date.now(), timeFlag = null -
ghostcode renamed this gist
Dec 21, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ghostcode revised this gist
Dec 21, 2022 . No changes.There are no files selected for viewing
-
ghostcode revised this gist
Dec 21, 2022 . No changes.There are no files selected for viewing
-
ghostcode revised this gist
Dec 21, 2022 . 1 changed file with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,20 @@ function throttle(fn,wait=3000){ let lastTime = Date.now(), timeFlag = null return function(...args){ let current = Date.now() clearTimeout(timeFlag) if(current - lastTime >= wait){ fn.apply(this,args) lastTime = current }else{ timeFlag = setTimeout(()=>{ fn.apply(this,args) lastTime = current },wait) } } } -
ghostcode created this gist
Dec 21, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@