Skip to content

Commit 5a5b1e5

Browse files
move file (#1463)
1 parent 3746cc5 commit 5a5b1e5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

examples/_data.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export const sidebar = [
5555
"https://www.youtube.com/watch?v=bTmO5Tfgke4&list=PLvvLnBDNuTEov9EBIp3MMfHlBxaKGRWTe&index=10",
5656
type: "video",
5757
},
58+
{
59+
title: "Top level await",
60+
href: "/examples/top_level_await/",
61+
type: "example",
62+
},
5863
{
5964
title: "Update from CommonJS to ESM",
6065
href: "/examples/cjs_to_esm_tutorial/",

examples/await-commonjs.ts renamed to examples/scripts/top_level_await.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* @difficulty beginner
44
* @tags cli
55
* @resource {https://docs.deno.com/api/deno/~/Deno.readTextFile} Doc: Deno.readTextFile
6+
* @run <url>
67
* @group Basics
78
*
89
* Example of how top-level await can be used by default in Deno. This example would assist in migrating from NodeJS (CommonJS) to Deno.
@@ -12,7 +13,7 @@
1213

1314
// This example is what you may be used to with NodeJS when using CommonJS modules.
1415
// Notice that for "await" to be used in this example, it must be wrapped in an "async" function.
15-
const fs = require("fs");
16+
const fs = require("node:fs");
1617

1718
async function readFile() {
1819
try {

0 commit comments

Comments
 (0)