summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend-api-receiver.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/frontend-api-receiver.js')
-rw-r--r--ext/fg/js/frontend-api-receiver.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/fg/js/frontend-api-receiver.js b/ext/fg/js/frontend-api-receiver.js
index f5d29f67..687e5c3c 100644
--- a/ext/fg/js/frontend-api-receiver.js
+++ b/ext/fg/js/frontend-api-receiver.js
@@ -31,7 +31,7 @@ class FrontendApiReceiver {
port.onMessage.addListener(this.onMessage.bind(this, port));
}
- onMessage(port, {id, action, params, target}) {
+ onMessage(port, {id, action, params, target, senderId}) {
if (
target !== this.source ||
!this.handlers.hasOwnProperty(action)
@@ -39,24 +39,24 @@ class FrontendApiReceiver {
return;
}
- this.sendAck(port, id);
+ this.sendAck(port, id, senderId);
const handler = this.handlers[action];
handler(params).then(
result => {
- this.sendResult(port, id, {result});
+ this.sendResult(port, id, senderId, {result});
},
e => {
const error = typeof e.toString === 'function' ? e.toString() : e;
- this.sendResult(port, id, {error});
+ this.sendResult(port, id, senderId, {error});
});
}
- sendAck(port, id) {
- port.postMessage({type: 'ack', id});
+ sendAck(port, id, senderId) {
+ port.postMessage({type: 'ack', id, senderId});
}
- sendResult(port, id, data) {
- port.postMessage({type: 'result', id, data});
+ sendResult(port, id, senderId, data) {
+ port.postMessage({type: 'result', id, senderId, data});
}
}