summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShohei YOSHIDA <syohex@gmail.com>2020-05-14 12:54:57 +0900
committerGitHub <noreply@github.com>2020-05-14 05:54:57 +0200
commit45ec10535a797d96571d41a3753c9db16bafc15b (patch)
tree16237241cf087f86ce5c908ca55d0ef90a792b35
parentd397b86c6cea1517342dfa92055d8ed00c564ee1 (diff)
docs: add 'ts' tag to code blocks in manual/examples/os_signals.md (#5297)
This should enable syntax highlighting on the website.
-rw-r--r--docs/examples/os_signals.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/examples/os_signals.md b/docs/examples/os_signals.md
index 8c8dea880..71dca4d24 100644
--- a/docs/examples/os_signals.md
+++ b/docs/examples/os_signals.md
@@ -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");