Created
          April 3, 2020 14:04 
        
      - 
      
 - 
        
Save selcukcihan/1530aaa56b9c189eab8487a5402fbf89 to your computer and use it in GitHub Desktop.  
    Native modül kullanımına ön-yüz örneği
  
        
  
    
      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
    
  
  
    
  | <!doctype HTML> | |
| <html> | |
| <head></head> | |
| <body> | |
| <button id="uykuButonu">Uyu</button> | |
| <script type="module" src="./utils.js"></script> | |
| <script type="module" src="./index.js"></script> | |
| </body> | |
| </html> | 
  
    
      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
    
  
  
    
  | import {DEFAULT_SLEEP_MILLISECONDS, sleep} from './utils.js' | |
| document.getElementById('uykuButonu').addEventListener('click', async function() { | |
| await sleep(); | |
| alert('uyandım'); | |
| }); | 
  
    
      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
    
  
  
    
  | const DEFAULT_SLEEP_MILLISECONDS = 1000; | |
| function sleep(milliseconds) { | |
| return new Promise(resolve => | |
| setTimeout(resolve, milliseconds || DEFAULT_SLEEP_MILLISECONDS) | |
| ); | |
| } | |
| export { DEFAULT_SLEEP_MILLISECONDS, sleep } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment