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:
parent
d397b86c6c
commit
45ec10535a
1 changed files with 6 additions and 4 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue