1
0
Fork 0
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:
tokiedokie 2020-08-15 22:46:36 +09:00 committed by GitHub
parent b9adfe53d3
commit 496c9d73a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.