Skip to content

Commit 968b5d3

Browse files
committed
update js doc
1 parent 411ae1d commit 968b5d3

File tree

14 files changed

+1379
-2
lines changed

14 files changed

+1379
-2
lines changed

docs/guide/js/bundler.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
Setting up dev env...
1+
# Modern JavaScript development
2+
3+
Modern web development rely on package manager to bring project dependencies. This section covers how published releases can be used within a JavaScript project.
4+
5+
## Project setup
6+
7+
In the simple example we are going to use [Vite](https://vite.dev/) with Vanilla JavaScript. The full code is available for reference [here](https://github.com/Kitware/vtk-wasm/tree/main/examples/js/simple-app).
8+
9+
::: code-group
10+
<<< ../../../examples/js/simple-app/package.json
11+
<<< ../../../examples/js/simple-app/index.html
12+
<<< ../../../examples/js/simple-app/src/main.js [src/main.js]
13+
<<< ../../../examples/js/simple-app/src/example.js [src/example.js]
14+
<<< ../../../examples/js/simple-app/src/style.css [src/style.css]
15+
```bash [Install/Build]
16+
npm install
17+
npm run build
18+
```
19+
:::
20+
21+
Since we are not publishing our WASM bundle to npm yet, we are using the one hosted on our documentation web site under `https://kitware.github.io/vtk-wasm/wasm32/9.5.0/vtkWebAssemblyInterface.mjs`. But you can also download it from our [CI registry](https://gitlab.kitware.com/vtk/vtk/-/packages?orderBy=created_at&sort=desc&search[]=wasm) and serve it or import it yourself.
22+
23+
24+
## Result
25+
26+
<iframe src="/vtk-wasm/demo/simple-app/index.html" style="width: 100%; height: 25vh; border: none;"></iframe>

docs/public/demo/simple-app/assets/index-BFGc5eGd.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/public/demo/simple-app/assets/index-C-oi-tv4.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/public/demo/simple-app/assets/index-linop_gd.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<script
6+
type="module"
7+
src="https://kitware.github.io/vtk-wasm/wasm32/9.5.0/vtkWebAssemblyInterface.mjs"
8+
></script>
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<title>Standalone VTK.wasm example</title>
11+
<script type="module" crossorigin src="./assets/index-BFGc5eGd.js"></script>
12+
<link rel="stylesheet" crossorigin href="./assets/index-linop_gd.css">
13+
</head>
14+
<body>
15+
<div id="app">
16+
<canvas></canvas>
17+
</div>
18+
</body>
19+
</html>

docs/public/demo/viewer-basic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"/vtk-wasm/data/bike-export.wazex",
1111
"/vtk-wasm/wasm32/9.5.0",
1212
{
13-
rendering: 'webgl',
13+
rendering: 'webgl', // 'webgpu'
1414
},
1515
);
1616
</script>

examples/js/simple-app/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

examples/js/simple-app/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<script
6+
type="module"
7+
src="https://kitware.github.io/vtk-wasm/wasm32/9.5.0/vtkWebAssemblyInterface.mjs"
8+
></script>
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<title>Standalone VTK.wasm example</title>
11+
</head>
12+
<body>
13+
<div id="app">
14+
<canvas></canvas>
15+
</div>
16+
<script type="module" src="/src/main.js"></script>
17+
</body>
18+
</html>

0 commit comments

Comments
 (0)