adapt to the new specs of webxdc.sendUpdate()

master
adbenitez 2022-01-16 00:51:51 -05:00
parent eb59df379b
commit 79eb1e4a1e
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@
function sendMsg() {
msg = document.getElementById("input").value;
window.webxdc.sendUpdate({"name": window.webxdc.selfName(), "msg": msg}, 'someone typed "'+msg+'"');
window.webxdc.sendUpdate({payload: {name: window.webxdc.selfName(), msg: msg}}, 'someone typed "'+msg+'"');
}
function receiveUpdate(update) {

View File

@ -27,9 +27,9 @@ window.webxdc = (() => {
var updatesJSON = window.localStorage.getItem(updatesKey);
return updatesJSON ? JSON.parse(updatesJSON) : [];
},
sendUpdate: (payload, description) => {
sendUpdate: (update, description) => {
// alert(description+"\n\n"+JSON.stringify(payload));
var update = {payload: payload};
update = {payload: update.payload, summary: update.summary, info: update.info}
console.log('[Webxdc] description="' + description + '", ' + JSON.stringify(update));
updateListener(update);
var updatesJSON = window.localStorage.getItem(updatesKey);