-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add examples for sendUpdate
, setUpdateListener
#82
base: main
Are you sure you want to change the base?
Conversation
40ac2ef
to
f9a7c9a
Compare
thanks! the
and i would do this without any extra function. Anything more advanced should be link to a github-repo if needed. |
Closes #60 Some might say that the setUpdateListener example is too convoluted, but you can't really showcase the usage of `serial` without this much code. Plus, a briefer example is already shown in `sendUpdate()` docs. The code has been tested with the `webxdc-dev` tool, and (mostly) fomatted with Prettier.
f9a7c9a
to
7263ac5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some changes needed i think still
Co-authored-by: holger krekel <[email protected]>
} | ||
|
||
// Peers can send messages like this | ||
window.webxdc.sendUpdate({ payload: "Knight d3" }, "Bob made a move!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above you talk about a hyptothetic chess thing, but suddenly you send a move.
I'd rather stay within the "document state" terminology.
window.webxdc.sendUpdate({ payload: "Knight d3" }, "Bob made a move!"); | |
window.webxdc.sendUpdate({ payload: "new document set from ${window.webxdc.selfName}" }); |
// Yours might be more complex, | ||
// such as applying a chess move to the board. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Yours might be more complex, | |
// such as applying a chess move to the board. |
Ok, feel free to proceed with the suggestions. |
Closes #60
Some might say that the setUpdateListener example is too convoluted, but you can't really showcase the usage ofserial
without this much code.Plus, a briefer example is already shown insendUpdate()
docs.Update: I simplified the example.
The code has been tested with the
webxdc-dev
tool,and (mostly) fomatted with Prettier.