From 79eb1e4a1ec3a2d8fea0a15be62c5ccc961a8c11 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Sun, 16 Jan 2022 00:51:51 -0500 Subject: [PATCH] adapt to the new specs of webxdc.sendUpdate() --- index.html | 2 +- webxdc.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index f1f8ddd..430815d 100644 --- a/index.html +++ b/index.html @@ -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) { diff --git a/webxdc.js b/webxdc.js index 4e88cce..67894b9 100644 --- a/webxdc.js +++ b/webxdc.js @@ -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);