1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-08 15:19:40 -05:00

docs: add 'ts' tag to code blocks in manual/examples/os_signals.md (#5297)

This should enable syntax highlighting on the website.
This commit is contained in:
Shohei YOSHIDA 2020-05-14 12:54:57 +09:00 committed by GitHub
parent d397b86c6c
commit 45ec10535a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@
You can use `Deno.signal()` function for handling OS signals.
```
```ts
for await (const _ of Deno.signal(Deno.Signal.SIGINT)) {
console.log("interrupted!");
}
@ -15,7 +15,7 @@ for await (const _ of Deno.signal(Deno.Signal.SIGINT)) {
`Deno.signal()` also works as a promise.
```
```ts
await Deno.signal(Deno.Singal.SIGINT);
console.log("interrupted!");
```
@ -23,9 +23,11 @@ console.log("interrupted!");
If you want to stop watching the signal, you can use `dispose()` method of the
signal object.
```
```ts
const sig = Deno.signal(Deno.Signal.SIGINT);
setTimeout(() => { sig.dispose(); }, 5000);
setTimeout(() => {
sig.dispose();
}, 5000);
for await (const _ of sig) {
console.log("interrupted");