Starting fixing unhandled promises
This commit is contained in:
parent
bade2b41b6
commit
6e27ffb2d5
7 changed files with 18 additions and 19 deletions
|
@ -35,7 +35,6 @@ module.exports = {
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
"@typescript-eslint/no-explicit-any": "error",
|
||||||
// TODO: remove those ignored rules and write a stronger code!
|
// TODO: remove those ignored rules and write a stronger code!
|
||||||
"@typescript-eslint/no-floating-promises": "off",
|
|
||||||
"@typescript-eslint/no-unsafe-call": "off",
|
"@typescript-eslint/no-unsafe-call": "off",
|
||||||
"@typescript-eslint/restrict-plus-operands": "off",
|
"@typescript-eslint/restrict-plus-operands": "off",
|
||||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||||
|
|
|
@ -20,62 +20,62 @@ class AnalyticsClient {
|
||||||
identifyUser(uuid: string, email: string | null) {
|
identifyUser(uuid: string, email: string | null) {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.identify(uuid, { uuid, email, wa: true });
|
posthog.identify(uuid, { uuid, email, wa: true });
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
loggedWithSso() {
|
loggedWithSso() {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-logged-sso");
|
posthog.capture("wa-logged-sso");
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
loggedWithToken() {
|
loggedWithToken() {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-logged-token");
|
posthog.capture("wa-logged-token");
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
enteredRoom(roomId: string, roomGroup: string | null) {
|
enteredRoom(roomId: string, roomGroup: string | null) {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("$pageView", { roomId, roomGroup });
|
posthog.capture("$pageView", { roomId, roomGroup });
|
||||||
posthog.capture("enteredRoom");
|
posthog.capture("enteredRoom");
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
openedMenu() {
|
openedMenu() {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-opened-menu");
|
posthog.capture("wa-opened-menu");
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
launchEmote(emote: string) {
|
launchEmote(emote: string) {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-emote-launch", { emote });
|
posthog.capture("wa-emote-launch", { emote });
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
enteredJitsi(roomName: string, roomId: string) {
|
enteredJitsi(roomName: string, roomId: string) {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-entered-jitsi", { roomName, roomId });
|
posthog.capture("wa-entered-jitsi", { roomName, roomId });
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
validationName() {
|
validationName() {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-name-validation");
|
posthog.capture("wa-name-validation");
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
validationWoka(scene: string) {
|
validationWoka(scene: string) {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-woka-validation", { scene });
|
posthog.capture("wa-woka-validation", { scene });
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
validationVideo() {
|
validationVideo() {
|
||||||
this.posthogPromise?.then((posthog) => {
|
this.posthogPromise?.then((posthog) => {
|
||||||
posthog.capture("wa-video-validation");
|
posthog.capture("wa-video-validation");
|
||||||
});
|
}).catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const analyticsClient = new AnalyticsClient();
|
export const analyticsClient = new AnalyticsClient();
|
||||||
|
|
|
@ -26,7 +26,7 @@ export class ActionMessage {
|
||||||
this.message = actionMessageOptions.message;
|
this.message = actionMessageOptions.message;
|
||||||
this.type = actionMessageOptions.type ?? "message";
|
this.type = actionMessageOptions.type ?? "message";
|
||||||
this.callback = actionMessageOptions.callback;
|
this.callback = actionMessageOptions.callback;
|
||||||
this.create();
|
this.create().catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async create() {
|
private async create() {
|
||||||
|
|
|
@ -95,7 +95,7 @@ export function createState(target: "global" | "player"): WorkadventureStateComm
|
||||||
set(target: WorkadventureStateCommands, p: PropertyKey, value: unknown, receiver: unknown): boolean {
|
set(target: WorkadventureStateCommands, p: PropertyKey, value: unknown, receiver: unknown): boolean {
|
||||||
// Note: when using "set", there is no way to wait, so we ignore the return of the promise.
|
// Note: when using "set", there is no way to wait, so we ignore the return of the promise.
|
||||||
// User must use WA.state.saveVariable to have error message.
|
// User must use WA.state.saveVariable to have error message.
|
||||||
target.saveVariable(p.toString(), value);
|
target.saveVariable(p.toString(), value).catch(e => console.error(e));
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
has(target: WorkadventureStateCommands, p: PropertyKey): boolean {
|
has(target: WorkadventureStateCommands, p: PropertyKey): boolean {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
HTMLAudioPlayer.loop = get(audioManagerVolumeStore).loop;
|
HTMLAudioPlayer.loop = get(audioManagerVolumeStore).loop;
|
||||||
HTMLAudioPlayer.volume = get(audioManagerVolumeStore).volume;
|
HTMLAudioPlayer.volume = get(audioManagerVolumeStore).volume;
|
||||||
HTMLAudioPlayer.muted = get(audioManagerVolumeStore).muted;
|
HTMLAudioPlayer.muted = get(audioManagerVolumeStore).muted;
|
||||||
HTMLAudioPlayer.play();
|
void HTMLAudioPlayer.play();
|
||||||
});
|
});
|
||||||
unsubscriberVolumeStore = audioManagerVolumeStore.subscribe((audioManager: audioManagerVolume) => {
|
unsubscriberVolumeStore = audioManagerVolumeStore.subscribe((audioManager: audioManagerVolume) => {
|
||||||
const reduceVolume = audioManager.talking && audioManager.decreaseWhileTalking;
|
const reduceVolume = audioManager.talking && audioManager.decreaseWhileTalking;
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
uploadAudioActive = true;
|
uploadAudioActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function send() {
|
async function send(): Promise<void> {
|
||||||
if (inputSendTextActive) {
|
if (inputSendTextActive) {
|
||||||
handleSendText.sendTextMessage(broadcastToWorld);
|
return handleSendText.sendTextMessage(broadcastToWorld);
|
||||||
}
|
}
|
||||||
if (uploadAudioActive) {
|
if (uploadAudioActive) {
|
||||||
handleSendAudio.sendAudioMessage(broadcastToWorld);
|
return handleSendAudio.sendAudioMessage(broadcastToWorld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -41,10 +41,10 @@
|
||||||
gameManager.leaveGame(SelectCharacterSceneName, new SelectCharacterScene());
|
gameManager.leaveGame(SelectCharacterSceneName, new SelectCharacterScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
function logOut() {
|
async function logOut() {
|
||||||
disableMenuStores();
|
disableMenuStores();
|
||||||
loginSceneVisibleStore.set(true);
|
loginSceneVisibleStore.set(true);
|
||||||
connectionManager.logout();
|
return connectionManager.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProfileUrl() {
|
function getProfileUrl() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue