-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add web-component, and use docs/ for gh-pages
- Loading branch information
Showing
18 changed files
with
99 additions
and
61 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<html> | ||
<head> | ||
<title>Null0</title> | ||
|
||
<style> | ||
body { | ||
margin: auto; | ||
margin-top: 20px; | ||
width: 1024px; | ||
background: black; | ||
color: white; | ||
font-family: sans-serif; | ||
} | ||
null0-cart { | ||
margin: 10px; | ||
} | ||
</style> | ||
|
||
<script type="module"> | ||
import './null0_wc.js' | ||
|
||
// here is how to do it without the web-component | ||
// import { setupCart } from './null0.js' | ||
// const cart = await setupCart('cart/input.null0') | ||
</script> | ||
|
||
</head> | ||
<body> | ||
<p>Here are some example carts:</p> | ||
|
||
<null0-cart src="cart/input.null0"></null0-cart> | ||
<null0-cart src="cart/colorbars.null0"></null0-cart> | ||
<null0-cart src="cart/draw.null0"></null0-cart> | ||
<!-- <null0-cart src="cart/filesystem.null0"></null0-cart> --> | ||
<!-- <null0-cart src="cart/flappybird.null0"></null0-cart> --> | ||
<null0-cart src="cart/hello.null0"></null0-cart> | ||
<!-- <null0-cart src="cart/justlog.null0"></null0-cart> --> | ||
</body> | ||
</html> |
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// this will setup the web-component | ||
|
||
import setupCart from './null0.js' | ||
|
||
export default class Null0WebComponent extends HTMLElement { | ||
constructor() { | ||
super() | ||
this.shadow = this.attachShadow({ mode: 'open' }) | ||
this.canvas = document.createElement('canvas') | ||
this.shadow.appendChild(this.canvas) | ||
|
||
if (!this.attributes?.src?.value) { | ||
throw new Error('src attribute is required, and should point to your cart URL.') | ||
} | ||
setupCart(this.attributes.src.value, this.canvas).then(({host, cart}) => { | ||
this.host = host | ||
this.cart = cart | ||
}) | ||
} | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', () => { | ||
window.customElements.define('null0-cart', Null0WebComponent) | ||
}) |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
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 |
---|---|---|
|
@@ -9,10 +9,10 @@ | |
"gen:wamr": "node tools/gen_wamr.js", | ||
"gen:funcs": "node tools/gen_funcs.js", | ||
"gen:web": "node tools/gen_web.js", | ||
"start": "npm run build:web && npm run build:carts && live-server --mount=/wasm:./wbuild/host --mount=/cart:./build/cart/c web", | ||
"start": "npm run build:web && npm run build:carts && live-server docs", | ||
"build:carts": "cmake -GNinja -B build -DHOST=0 -DTESTS=0 -DCARTS=1 && cmake --build build", | ||
"build:host": "cmake -GNinja -B build -DHOST=1 -DTESTS=0 -DCARTS=0 && cmake --build build", | ||
"build:web": "emcmake cmake -DHOST=1 -DTESTS=0 -DCARTS=0 -GNinja -B wbuild && cmake --build wbuild" | ||
"build:web": "emcmake cmake -DHOST=1 -DTESTS=0 -DCARTS=0 -GNinja -B wbuild && cmake --build wbuild && mkdir -p docs/wasm docs/cart && cp wbuild/host/null0.* docs/wasm && cp build/cart/c/*.null0 docs/cart" | ||
}, | ||
"keywords": [], | ||
"author": "David Konsumer <[email protected]>", | ||
|
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
This file was deleted.
Oops, something went wrong.