@verygoodgraphics/vgg-wasm
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -44,3 +44,3 @@ var f = Object.defineProperty; | ||
} | ||
const g = class g { | ||
const d = class d { | ||
// private VGGNodes = {} as Record<T, VGGNode> | ||
@@ -86,3 +86,3 @@ constructor(e) { | ||
if (!this.src) | ||
throw new Error(g.missingErrorMessage); | ||
throw new Error(d.missingErrorMessage); | ||
return new Promise((t) => { | ||
@@ -122,3 +122,3 @@ this.requestAnimationFrame = requestAnimationFrame( | ||
listener: (h) => { | ||
var d; | ||
var l; | ||
const o = JSON.parse(h); | ||
@@ -129,3 +129,3 @@ this.verbose && console.log( | ||
o.id ? `${o.id} → ${o.path}` : "" | ||
), o.type === "select" && ((d = this.observables.get(o.path)) == null || d.next("click"), this.eventManager.fire({ | ||
), o.type === "select" && ((l = this.observables.get(o.path)) == null || l.next("click"), this.eventManager.fire({ | ||
type: a.Click, | ||
@@ -231,4 +231,4 @@ data: o | ||
// Error message for missing source | ||
s(g, "missingErrorMessage", "Daruma source file required"); | ||
let l = g; | ||
s(d, "missingErrorMessage", "Daruma source file required"); | ||
let g = d; | ||
class u { | ||
@@ -262,6 +262,7 @@ constructor(e, t) { | ||
} | ||
typeof window < "u" && (window.VGG = g); | ||
export { | ||
a as EventType, | ||
c as State, | ||
l as VGG | ||
g as VGG | ||
}; |
@@ -9,3 +9,3 @@ { | ||
"license": "MIT", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"type": "module", | ||
@@ -12,0 +12,0 @@ "files": [ |
@@ -5,3 +5,77 @@ # VGG WASM | ||
```js | ||
### Import through CDN | ||
```html | ||
<script | ||
type="module" | ||
src="https://www.unpkg.com/@verygoodgraphics/vgg-wasm?module" | ||
></script> | ||
<script> | ||
const vgg = new VGG({ | ||
src: "https://s5.vgg.cool/vgg.daruma", | ||
// editMode: true, | ||
verbose: true, | ||
canvas: document.querySelector("#canvas"), | ||
onSelect: async (event) => console.log("Select", event), | ||
// onLoad: async (event) => console.log("Load", event), | ||
// onLoadError: async (event) => console.log("Load Error", event), | ||
// onStateChange: async (state) => console.log("State Change", state), | ||
}) | ||
console.log({ vgg }) | ||
await vgg.load() | ||
if (vgg.state === 'ready') { | ||
await vgg.render() | ||
// { | ||
// const { nodes } = await vgg.render() | ||
// const keys = Object.keys(nodes) | ||
// .map((i) => `"${i}"`) | ||
// .join(" | ") | ||
// console.log(keys) | ||
// } | ||
vgg.$("#vgg_home").on('click', async () => { | ||
window.alert("Hello, VGG!") | ||
}) | ||
} | ||
</script> | ||
``` | ||
```html | ||
<script type="module"> | ||
const vgg = new VGG({ | ||
src: "https://s5.vgg.cool/vgg.daruma", | ||
// editMode: true, | ||
verbose: true, | ||
canvas: document.querySelector("#canvas"), | ||
onSelect: async (event) => console.log("Select", event), | ||
// onLoad: async (event) => console.log("Load", event), | ||
// onLoadError: async (event) => console.log("Load Error", event), | ||
// onStateChange: async (state) => console.log("State Change", state), | ||
}) | ||
console.log({ vgg }) | ||
await vgg.load() | ||
if (vgg.state === State.Ready) { | ||
await vgg.render() | ||
// { | ||
// const { nodes } = await vgg.render() | ||
// const keys = Object.keys(nodes) | ||
// .map((i) => `"${i}"`) | ||
// .join(" | ") | ||
// console.log(keys) | ||
// } | ||
vgg.$("#vgg_home").on(EventType.Click, async () => { | ||
window.alert("Hello, VGG!") | ||
}) | ||
} | ||
</script> | ||
``` | ||
```ts | ||
import { VGG } from "@verygoodgraphics/vgg-wasm" | ||
@@ -14,4 +88,3 @@ | ||
if (vgg.state === State.Ready) | ||
await vgg.render() | ||
if (vgg.state === State.Ready) await vgg.render() | ||
``` | ||
@@ -18,0 +91,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21415
386
121