This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let result; | |
| result = await delay(() => '[RETURN VALUE 1]', 1000); | |
| console.log(result); // [RETURN VALUE 1] in result | |
| result = await delay(() => '[RETURN VALUE 2]', 1000); | |
| console.log(result); // [RETURN VALUE 2] in result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function main() { | |
| const delaysInMs = [3000, 2000, 1000]; | |
| for (const time of delaysInMs) { | |
| const result = await delay(() => `print after ${time / 1000} second(s)`, time); | |
| console.log(result); | |
| } | |
| } | |
| main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function main() { | |
| let count = 0; | |
| const max = 5; | |
| while (count < max) { | |
| const result = await delay(() => `${++count} of ${max} lines...`, 1000); | |
| console.log(result); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Snowpack Skypack React</title> | |
| </head> | |
| <body> | |
| Hello World. | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'https://cdn.skypack.dev/react'; | |
| import ReactDOM from 'https://cdn.skypack.dev/react-dom'; | |
| const App = () => { | |
| return ( | |
| <h1>Hello World x2</h1> | |
| ); | |
| } | |
| ReactDOM.render(<App />, document.getElementById("root")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Snowpack Skypack React</title> | |
| </head> | |
| <body> | |
| <div id="root"></div> | |
| <script type="module" src="main.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Section: Dependencies */ | |
| /* Section: Constants */ | |
| /* Section: Interfaces and Globals */ | |
| /* Step 0: Grab CLI arguments */ | |
| /* Step 1: Parse metadata and components from markdown file */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Step 0: Grab CLI arguments */ | |
| const filename = Deno.args[FIRST_ITEM_INDEX]; | |
| const buildPath = Deno.args[SECOND_ITEM_INDEX] || './build'; | |
| if (!filename) { | |
| console.log('Please specify .md file'); | |
| Deno.exit(1); | |
| } else { | |
| console.log(`Building site with '${filename}' into '${buildPath}'`); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Section: Interfaces and Globals */ | |
| interface Page { | |
| path: string, | |
| name: string, | |
| html: string | |
| } | |
| interface Layout { | |
| [key: string]: any | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Section: Dependencies */ | |
| import { Marked } from 'https://deno.land/x/markdown@v2.0.0/mod.ts'; | |
| import { ensureFileSync } from 'https://deno.land/std@0.84.0/fs/mod.ts'; |