Compare commits
2 Commits
e27ac71fa3
...
be495b1c56
| Author | SHA1 | Date | |
|---|---|---|---|
| be495b1c56 | |||
| 3f032619b4 |
@ -99,14 +99,14 @@ export default class EventBus {
|
|||||||
commandId: context.commandId,
|
commandId: context.commandId,
|
||||||
comms: context.comms ? {
|
comms: context.comms ? {
|
||||||
forwardTo: context.comms.forwardTo,
|
forwardTo: context.comms.forwardTo,
|
||||||
sourceFrame: context.comms.sourceFrame ? { ...context.comms.sourceFrame } : undefined
|
sourceFrame: context.comms?.sourceFrame ? { ...context.comms?.sourceFrame } : undefined
|
||||||
} : undefined,
|
} : undefined,
|
||||||
borderCrossings: context.borderCrossings ? { ...context.borderCrossings } : undefined
|
borderCrossings: context.borderCrossings ? { ...context.borderCrossings } : undefined
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
send(command: string, commandData: any, context: EventBusContext = {}) {
|
send(command: string, commandData: any, context: EventBusContext = {}) {
|
||||||
context = this.cloneContext(context);
|
context = this.cloneContext(context); // Firefox throws an error if we don't clone the context.
|
||||||
|
|
||||||
if (context.visitedBusses?.includes(this.uuid)) {
|
if (context.visitedBusses?.includes(this.uuid)) {
|
||||||
console.warn('this bus was already visited before. Doing nothing.');
|
console.warn('this bus was already visited before. Doing nothing.');
|
||||||
|
|||||||
@ -266,11 +266,11 @@ class CommsServer {
|
|||||||
* @param frame
|
* @param frame
|
||||||
*/
|
*/
|
||||||
private async sendToOtherFrames(message, context) {
|
private async sendToOtherFrames(message, context) {
|
||||||
const sender = context.comms.sourceFrame;
|
const sender = context.comms?.sourceFrame;
|
||||||
|
|
||||||
const enrichedMessage = {
|
const enrichedMessage = {
|
||||||
message,
|
message,
|
||||||
_sourceFrame: context.comms.sourceFrame,
|
_sourceFrame: context.comms?.sourceFrame,
|
||||||
_sourcePort: context.comms.port
|
_sourcePort: context.comms.port
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,14 +99,14 @@ export default class IframeManager {
|
|||||||
} else {
|
} else {
|
||||||
this.iframeList.push({
|
this.iframeList.push({
|
||||||
...data,
|
...data,
|
||||||
...context.comms.sourceFrame
|
...context.comms?.sourceFrame
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleFrameDestroyed(context) {
|
private handleFrameDestroyed(context) {
|
||||||
// tab IDs should be the same for all items, making frameId sufficiently unique to filter stuff
|
// tab IDs should be the same for all items, making frameId sufficiently unique to filter stuff
|
||||||
this.iframeList = this.iframeList.filter(x => x.frameId !== context.comms.sourceFrame.frameId);
|
this.iframeList = this.iframeList.filter(x => x.frameId !== context.comms?.sourceFrame?.frameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user