- From: Keith Cirkel <notifications@github.com>
- Date: Wed, 05 Jul 2023 02:25:11 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 5 July 2023 09:25:16 UTC
You can attach data to the `Error` class:
```js
const reason = new Error('User clicked Kill Now')
reason.force = true
function aborted (event) {
if (event.target.reason.force) {
kill()
} else {
cancel()
}
}
```
Or use two signals:
```js
let shuttingDown = false
process.on('SIGINT', () => {
if (!shuttingDown) {
// First interrupt, start graceful shutdown
shuttingDown = true
program.closed.then(() => { process.exit() })
gracefulController.abort()
} else {
// Second interrupt, kill everything now
forcefulController.abort()
}
})
```
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1215#issuecomment-1621372035
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/1215/1621372035@github.com>
Received on Wednesday, 5 July 2023 09:25:16 UTC