mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
improve docs (#7053)
This commit is contained in:
parent
b9adfe53d3
commit
496c9d73a1
1 changed files with 4 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
[API Reference](https://doc.deno.land/https/raw.githubusercontent.com/denoland/deno/master/cli/dts/lib.deno.unstable.d.ts#Deno.signal)
|
||||
|
||||
You can use `Deno.signal()` function for handling OS signals.
|
||||
You can use `Deno.signal()` function for handling OS signals:
|
||||
|
||||
```ts
|
||||
for await (const _ of Deno.signal(Deno.Signal.SIGINT)) {
|
||||
|
@ -13,7 +13,7 @@ for await (const _ of Deno.signal(Deno.Signal.SIGINT)) {
|
|||
}
|
||||
```
|
||||
|
||||
`Deno.signal()` also works as a promise.
|
||||
`Deno.signal()` also works as a promise:
|
||||
|
||||
```ts
|
||||
await Deno.signal(Deno.Signal.SIGINT);
|
||||
|
@ -21,7 +21,7 @@ console.log("interrupted!");
|
|||
```
|
||||
|
||||
If you want to stop watching the signal, you can use `dispose()` method of the
|
||||
signal object.
|
||||
signal object:
|
||||
|
||||
```ts
|
||||
const sig = Deno.signal(Deno.Signal.SIGINT);
|
||||
|
@ -34,4 +34,4 @@ for await (const _ of sig) {
|
|||
}
|
||||
```
|
||||
|
||||
The above for-await loop exits after 5 seconds when sig.dispose() is called.
|
||||
The above for-await loop exits after 5 seconds when `sig.dispose()` is called.
|
||||
|
|
Loading…
Reference in a new issue