Created
September 25, 2018 11:38
-
-
Save ThomasKruegl/1c41afdf5f4b579d82369fa615a43f4f to your computer and use it in GitHub Desktop.
This file contains 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
"use strict"; | |
function asyncStuff() { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => resolve("finished"), 2000); | |
}); | |
} | |
function killedHandler() { | |
console.log("killedHandler called"); | |
asyncStuff().then(console.log); | |
// process.exit(1); | |
} | |
process.on("SIGINT", killedHandler); | |
function foo() { | |
console.log("foo"); | |
} | |
const Timer = setInterval(foo, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment