preparation for merge with metadataScriptApi
This commit is contained in:
parent
46996f7049
commit
b18b2fe0e3
3 changed files with 10 additions and 12 deletions
|
@ -1,9 +1,7 @@
|
|||
|
||||
import * as tg from "generic-type-guard";
|
||||
export const updateTile = "updateTile"
|
||||
|
||||
|
||||
export const isUpdateTileEvent = tg.isArray(
|
||||
export const isChangeTileEvent = tg.isArray(
|
||||
new tg.IsInterface().withProperties({
|
||||
x: tg.isNumber,
|
||||
y: tg.isNumber,
|
||||
|
@ -14,4 +12,4 @@ export const isUpdateTileEvent = tg.isArray(
|
|||
/**
|
||||
* A message sent from the game to the iFrame when a user enters or leaves a zone marked with the "zone" property.
|
||||
*/
|
||||
export type UpdateTileEvent = tg.GuardedType<typeof isUpdateTileEvent>;
|
||||
export type ChangeTileEvent = tg.GuardedType<typeof isChangeTileEvent>;
|
|
@ -13,7 +13,7 @@ import { scriptUtils } from "./ScriptUtils";
|
|||
import { GoToPageEvent, isGoToPageEvent } from "./Events/GoToPageEvent";
|
||||
import { isOpenCoWebsite, OpenCoWebSiteEvent } from "./Events/OpenCoWebSiteEvent";
|
||||
import { isLoadPageEvent } from './Events/LoadPageEvent';
|
||||
import { isUpdateTileEvent, UpdateTileEvent } from './Events/ApiUpdateTileEvent';
|
||||
import { isChangeTileEvent, ChangeTileEvent } from './Events/ChangeTileEvent';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ class IframeListener {
|
|||
private readonly _removeBubbleStream: Subject<void> = new Subject();
|
||||
public readonly removeBubbleStream = this._removeBubbleStream.asObservable();
|
||||
|
||||
private readonly _updateTileEvent: Subject<UpdateTileEvent> = new Subject();
|
||||
private readonly _updateTileEvent: Subject<ChangeTileEvent> = new Subject();
|
||||
public readonly updateTileEvent = this._updateTileEvent.asObservable();
|
||||
|
||||
private readonly iframes = new Set<HTMLIFrameElement>();
|
||||
|
@ -114,7 +114,7 @@ class IframeListener {
|
|||
this._removeBubbleStream.next();
|
||||
} else if (payload.type === 'loadPage' && isLoadPageEvent(payload.data)) {
|
||||
this._loadPageStream.next(payload.data.url);
|
||||
} else if (payload.type == "updateTile" && isUpdateTileEvent(payload.data)) {
|
||||
} else if (payload.type == "updateTile" && isChangeTileEvent(payload.data)) {
|
||||
this._updateTileEvent.next(payload.data)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue