Skip to content

Commit 7f2d9ff

Browse files
committed
add new webxdc APIs: isBroadcast, isAppSender
1 parent 8f5a9ee commit 7f2d9ff

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/webxdc.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,14 @@ window.webxdc = (() => {
230230
});
231231

232232
const params = new URLSearchParams(window.location.hash.substr(1));
233+
const selfAddr = params.get("addr") || "device0@local.host";
233234
return {
234235
sendUpdateInterval: 1000,
235236
sendUpdateMaxSize: 999999,
236-
selfAddr: params.get("addr") || "device0@local.host",
237+
selfAddr,
237238
selfName: params.get("name") || "device0",
239+
isAppSender: selfAddr === "device0@local.host",
240+
isBroadcast: false,
238241
setUpdateListener: (cb, serial = 0) => {
239242
const updates = getUpdates();
240243
const maxSerial = updates.length;

0 commit comments

Comments
 (0)