Skip to content

Commit 2ff331d

Browse files
authored
Merge pull request #552 from Kaggle/message-passing-fns
Add message passing to environment parent
2 parents e4d140c + 5375158 commit 2ff331d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

web/core/src/legacy-adapter.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,23 @@ export class LegacyAdapter implements GameAdapter {
6161
height: this.container.clientHeight,
6262

6363
unstable_replayerControls: unstable_replayerControls,
64+
65+
// For message passing to an outer frame
66+
setCurrentStep: (step: number) =>
67+
window.parent.postMessage(
68+
{
69+
step,
70+
},
71+
'*'
72+
),
73+
setPlaying: (playing?: boolean) => {
74+
window.parent.postMessage(
75+
{
76+
playing,
77+
},
78+
'*'
79+
);
80+
},
6481
};
6582

6683
// Some legacy renderers take the container as a second argument.

0 commit comments

Comments
 (0)