From 9444bd71a0b9165ef1a900f19b08a88592d2bb5c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 20 Mar 2019 12:39:47 -0400 Subject: [PATCH] Website and manual improvements (#1967) --- js/metrics.ts | 14 +++++++++++++- website/index.html | 8 ++++---- website/manual.md | 21 +++++++++++++-------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/js/metrics.ts b/js/metrics.ts index 111015078f..c4ba14c7d3 100644 --- a/js/metrics.ts +++ b/js/metrics.ts @@ -34,7 +34,19 @@ function res(baseRes: null | msg.Base): Metrics { }; } -/** Receive metrics from the privileged side of Deno. */ +/** Receive metrics from the privileged side of Deno. + * + * > console.table(Deno.metrics()) + * ┌──────────────────┬────────┐ + * │ (index) │ Values │ + * ├──────────────────┼────────┤ + * │ opsDispatched │ 9 │ + * │ opsCompleted │ 9 │ + * │ bytesSentControl │ 504 │ + * │ bytesSentData │ 0 │ + * │ bytesReceived │ 856 │ + * └──────────────────┴────────┘ + */ export function metrics(): Metrics { return res(dispatch.sendSync(...req())); } diff --git a/website/index.html b/website/index.html index 2381288232..9f6e4b4bf6 100644 --- a/website/index.html +++ b/website/index.html @@ -17,7 +17,7 @@

Deno

- A browser-like command line runtime + A secure JavaScript/TypeScript runtime built with V8, Rust, and Tokio
@@ -109,11 +109,11 @@ href="https://github.com/denoland/deno_install/blob/master/install.ps1">https://

Or a more complex one:

import { serve } from "https://deno.land/std@v0.3.2/http/server.ts";
-const s = serve("0.0.0.0:8000");
 
 async function main() {
-  for await (const req of s) {
-    req.respond({ body: new TextEncoder().encode("Hello World\n") });
+  const body = new TextEncoder().encode("Hello World\n");
+  for await (const req of serve(":8000")) {
+    req.respond({ body });
   }
 }
 
diff --git a/website/manual.md b/website/manual.md
index 8d0dacabca..41a1b70268 100644
--- a/website/manual.md
+++ b/website/manual.md
@@ -148,10 +148,8 @@ submodule. However, you need to install separately:
 3. Python 2.
    [Not 3](https://github.com/denoland/deno/issues/464#issuecomment-411795578).
 
-Extra steps for Mac users:
-
-1. [XCode](https://developer.apple.com/xcode/)
-2. Openssl 1.1: `brew install openssl@1.1` (TODO: shouldn't be necessary)
+Extra steps for Mac users: install [XCode](https://developer.apple.com/xcode/)
+:(
 
 Extra steps for Windows users:
 
@@ -606,10 +604,17 @@ close(3);
 
 Metrics is deno's internal counters for various statics.
 
-```ts
-const { metrics } = Deno;
-console.log(metrics());
-// output like: { opsDispatched: 1, opsCompleted: 1, bytesSentControl: 40, bytesSentData: 0, bytesReceived: 176 }
+```shellsession
+> console.table(Deno.metrics())
+┌──────────────────┬────────┐
+│     (index)      │ Values │
+├──────────────────┼────────┤
+│  opsDispatched   │   9    │
+│   opsCompleted   │   9    │
+│ bytesSentControl │  504   │
+│  bytesSentData   │   0    │
+│  bytesReceived   │  856   │
+└──────────────────┴────────┘
 ```
 
 ### Schematic diagram