Make sure that initial status is drawn correctly
This commit is contained in:
parent
2ea5f45eb9
commit
55bf85268a
@ -30,9 +30,9 @@ export function initRepo() {
|
|||||||
document.location.hash = handle.url
|
document.location.hash = handle.url
|
||||||
}
|
}
|
||||||
|
|
||||||
handle.on("change", ({doc}) => {
|
// handle.on("change", ({doc}) => {
|
||||||
console.log("Document changed!", doc)
|
// console.log("Document changed!", doc)
|
||||||
})
|
// })
|
||||||
|
|
||||||
return handle
|
return handle
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,9 @@ const canvas = document.getElementById("shapesCanvas")
|
|||||||
const handle = initRepo()
|
const handle = initRepo()
|
||||||
await handle.whenReady()
|
await handle.whenReady()
|
||||||
|
|
||||||
|
// draw current state
|
||||||
|
drawAllShapesOnCanvas(canvas, handle.docSync().shapes)
|
||||||
|
|
||||||
// 2. Subscribe so we can re-render whenever doc changes
|
// 2. Subscribe so we can re-render whenever doc changes
|
||||||
// Listen for 'change' events
|
// Listen for 'change' events
|
||||||
handle.on("change", ({doc}) => {
|
handle.on("change", ({doc}) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user