The generation was broken due to the refactoring in several classes (some of them where not properly exported). Also, trying to generate the NPM package on every build now (to detect issues).
30 lines
1013 B
TypeScript
30 lines
1013 B
TypeScript
import { IframeApiContribution, sendToWorkadventure } from "./IframeApiContribution";
|
|
import type { HasPlayerMovedEvent, HasPlayerMovedEventCallback } from "../Events/HasPlayerMovedEvent";
|
|
import { Subject } from "rxjs";
|
|
import { apiCallback } from "./registeredCallbacks";
|
|
import { isHasPlayerMovedEvent } from "../Events/HasPlayerMovedEvent";
|
|
|
|
const moveStream = new Subject<HasPlayerMovedEvent>();
|
|
|
|
export class WorkadventurePlayerCommands extends IframeApiContribution<WorkadventurePlayerCommands> {
|
|
callbacks = [
|
|
apiCallback({
|
|
type: "hasPlayerMoved",
|
|
typeChecker: isHasPlayerMovedEvent,
|
|
callback: (payloadData) => {
|
|
moveStream.next(payloadData);
|
|
},
|
|
}),
|
|
];
|
|
|
|
onPlayerMove(callback: HasPlayerMovedEventCallback): void {
|
|
moveStream.subscribe(callback);
|
|
sendToWorkadventure({
|
|
type: "onPlayerMove",
|
|
data: null,
|
|
});
|
|
}
|
|
}
|
|
|
|
export default new WorkadventurePlayerCommands();
|