-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add and hello_world switched to direct import
- Loading branch information
1 parent
7e576ec
commit 29205c5
Showing
2 changed files
with
5 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// For more comments about what's going on here, check out the `hello_world` | ||
// example | ||
const rust = import('./pkg'); | ||
rust | ||
.then(m => alert('1 + 2 = ' + m.add(1, 2))) | ||
.catch(console.error); | ||
import { add } from './pkg'; | ||
|
||
alert('1 + 2 = ' + add(1, 2)) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// Note that a dynamic `import` statement here is required due to | ||
// webpack/webpack#6615, but in theory `import { greet } from './pkg';` | ||
// will work here one day as well! | ||
const rust = import('./pkg'); | ||
import { greet } from './pkg'; | ||
|
||
rust | ||
.then(m => m.greet('World!')) | ||
.catch(console.error); | ||
greet('World'); |