Created
March 31, 2020 12:56
-
-
Save selcukcihan/86d80594edf72b3709987ccff4ca33ec to your computer and use it in GitHub Desktop.
Native modül kullanımına örnek
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' | |
console.log(`${DEFAULT_SLEEP_MILLISECONDS} milisaniye uyuyalım `); | |
sleep() | |
.then(_ => { | |
console.log(`3000 milisaniye uyuyalım `); | |
return sleep(3000); | |
}); |
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
{ | |
"name": "moduller", | |
"type": "module" | |
} |
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