Created
          November 14, 2018 20:34 
        
      - 
      
 - 
        
Save onurkerimov/04ce5426fe054b5b9222478c78ddbda0 to your computer and use it in GitHub Desktop.  
    As used in here https://codepen.io/onurkerimov/pen/aQJeyg
  
        
  
    
      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 characters
    
  
  
    
  | window.addEventListener("mousemove", function(e) { | |
| debounce(200, fn.bind(this,e)) | |
| }); | |
| var waitFlag = false | |
| function debounce(time,fn) { | |
| if (!waitFlag) { | |
| fn() | |
| waitFlag = true | |
| setTimeout(function() { | |
| waitFlag = false | |
| }, time) | |
| } | |
| } | |
| function fn(e) { | |
| // Something computationally expensive | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment