Created
November 6, 2020 17:59
-
-
Save nornagon/5d0ba28f9509a85604628e70406f3f3c to your computer and use it in GitHub Desktop.
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
import('./test.mjs') // async import needed to allow for webpack download+compile |
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
npx webpack --entry ./index.mjs --experiments-sync-web-assembly | |
cat <<HTML > dist/index.html | |
<!doctype html> | |
<script src="./main.js"></script> | |
HTML | |
npx serve dist |
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
import wasmBackend from 'automerge-backend-wasm' | |
import Automerge from 'automerge' | |
wasmBackend.initCodecFunctions(Automerge) | |
Automerge.setDefaultBackend(wasmBackend) | |
let doc = Automerge.from({ cards: [] }) | |
doc = Automerge.change(doc, d => { | |
d.cards.push({ title: 'foo' }) | |
}) | |
console.log(doc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment