Skip to content

Commit

Permalink
Fix message id
Browse files Browse the repository at this point in the history
  • Loading branch information
rduteil committed Oct 9, 2024
1 parent 2bc82eb commit 58acdd5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Bones.UI/core/eventQueue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import _ from "lodash";
import Ajv, { JSONSchemaType, ValidateFunction } from "ajv";

import { uuidv4 } from "../tools";

interface WindowsMessage {
id: string;
topic: string;
Expand Down Expand Up @@ -55,8 +57,7 @@ export class EventQueue {
this.publishInternal(topic, payload);

if (window.top && window.top !== window.self) {
this.messageCounter++;
const id = "remote_" + this.messageCounter;
const id = uuidv4();

const message: WindowsMessage = {
id,
Expand All @@ -65,6 +66,7 @@ export class EventQueue {
};

this.buffer[this.messageCounter % bufferSize] = message.id;
this.messageCounter++;

window.top.postMessage(JSON.stringify(message), "*");
}
Expand Down

0 comments on commit 58acdd5

Please sign in to comment.