partey_workadventure/front/src/Api/ScriptUtils.ts

22 lines
658 B
TypeScript
Raw Normal View History

2021-10-12 10:38:49 +02:00
import { coWebsiteManager, CoWebsite } from "../WebRtc/CoWebsiteManager";
2021-09-13 14:48:19 +02:00
import { playersStore } from "../Stores/PlayersStore";
import { chatMessagesStore } from "../Stores/ChatStore";
import type { ChatEvent } from "./Events/ChatEvent";
class ScriptUtils {
public openTab(url: string) {
2021-03-28 16:36:02 +02:00
window.open(url);
}
public goToPage(url: string) {
window.location.href = url;
2021-03-28 16:36:02 +02:00
}
2021-09-13 14:48:19 +02:00
public sendAnonymousChat(chatEvent: ChatEvent) {
const userId = playersStore.addFacticePlayer(chatEvent.author);
chatMessagesStore.addExternalMessage(userId, chatEvent.message);
}
}
export const scriptUtils = new ScriptUtils();