From 8c3ee80b21278eaa6fb29f73b79c16d443923dfa Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Thu, 8 Sep 2022 02:33:44 +0200 Subject: xC/xP: finalize and implement Event.PING --- xP/public/xP.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xP') diff --git a/xP/public/xP.js b/xP/public/xP.js index 42a7a55..eb27b46 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -85,7 +85,8 @@ class RelayRpc extends EventTarget { if (typeof e.event !== 'string') throw "Invalid event tag" - this.dispatchEvent(new CustomEvent(e.event, {detail: e})) + this.dispatchEvent(new CustomEvent( + e.event, {detail: {eventSeq: message.eventSeq, ...e}})) // Minor abstraction layering violation. m.redraw() @@ -153,6 +154,10 @@ rpc.addEventListener('close', event => { m.redraw() }) +rpc.addEventListener('Ping', event => { + rpc.send({command: 'PingResponse', eventSeq: event.detail.eventSeq}) +}) + rpc.addEventListener('BufferUpdate', event => { let e = event.detail, b = buffers.get(e.bufferName) if (b === undefined) { -- cgit v1.2.3-70-g09d2