Makes onCameraUpdate subscribe-able

This commit is contained in:
Benedicte Quimbert 2021-12-30 15:50:52 +01:00
parent d9482d484b
commit 85d45071fa

View File

@ -1,6 +1,6 @@
import { IframeApiContribution, sendToWorkadventure } from "./IframeApiContribution"; import { IframeApiContribution, sendToWorkadventure } from "./IframeApiContribution";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import type { WasCameraUpdatedEvent, WasCameraUpdatedEventCallback } from "../Events/WasCameraUpdatedEvent"; import type { WasCameraUpdatedEvent } from "../Events/WasCameraUpdatedEvent";
import { apiCallback } from "./registeredCallbacks"; import { apiCallback } from "./registeredCallbacks";
import { isWasCameraUpdatedEvent } from "../Events/WasCameraUpdatedEvent"; import { isWasCameraUpdatedEvent } from "../Events/WasCameraUpdatedEvent";
@ -17,12 +17,12 @@ export class WorkAdventureCameraCommands extends IframeApiContribution<WorkAdven
}), }),
]; ];
onCameraUpdate(callback: WasCameraUpdatedEventCallback): void { onCameraUpdate(): Subject<WasCameraUpdatedEvent> {
moveStream.subscribe(callback);
sendToWorkadventure({ sendToWorkadventure({
type: "onCameraUpdate", type: "onCameraUpdate",
data: null, data: null,
}); });
return moveStream;
} }
} }