Skip to content

Commit

Permalink
Rename iframeLoaded to readyForMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
thsparks committed Jan 9, 2024
1 parent 281a215 commit 8d358c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions teachertool/src/services/makecodeEditorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface PendingMessage {
}

let makecodeEditorRef: HTMLIFrameElement | undefined;
let iframeLoaded: boolean;
let readyForMessages: boolean;
const messageQueue: pxt.editor.EditorMessageRequest[] = [];
let nextId: number = 0;
let pendingMessages: {[index: string]: PendingMessage} = {};
Expand All @@ -17,7 +17,7 @@ function onMessageReceived(event: MessageEvent) {
const data = event.data as pxt.editor.EditorMessageRequest;
if (data.type === "pxteditor") {
if (data.action === "editorcontentloaded") {
iframeLoaded = true;
readyForMessages = true;
sendMessageAsync(); // flush message queue.
}

Expand Down Expand Up @@ -64,7 +64,7 @@ function validateResponse(result: pxt.editor.EditorMessageResponse, expectRespon
}

export function setEditorRef(ref: HTMLIFrameElement | undefined) {
iframeLoaded = false;
readyForMessages = false;
makecodeEditorRef = ref ?? undefined;
window.removeEventListener("message", onMessageReceived);
if (ref) {
Expand Down

0 comments on commit 8d358c0

Please sign in to comment.