This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
generated from KennethTrecy/web_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from AteKitty07/seen_messages
Seen messages
- Loading branch information
Showing
10 changed files
with
348 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const CHAT_MESSAGE_ACTIVITY = Symbol("Key for chat activity resource of current user") | ||
export const CHAT_MESSAGE_ACTIVITIES_IN_CONSULTATION = Symbol("current chat message activity") | ||
|
||
export const BODY_CLASSES = Symbol("Key for body CSS manager") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { FocusListener } from "$@/types/dependent" | ||
|
||
import Stub from "$/singletons/stub" | ||
import RequestEnvironment from "$/singletons/request_environment" | ||
|
||
export default class extends RequestEnvironment { | ||
private static rawListeners: FocusListener[] = [] | ||
|
||
static addEventListener(listener: FocusListener): void { | ||
this.rawListeners.push(listener) | ||
Stub.runConditionally( | ||
() => { | ||
window.addEventListener("blur", () => { | ||
this.rawListeners.forEach(rawListener => rawListener("blur")) | ||
}) | ||
window.addEventListener("focus", () => { | ||
this.rawListeners.forEach(rawListener => rawListener("focus")) | ||
}) | ||
}, | ||
() => [ {} as unknown as void, { | ||
"arguments": [ listener ], | ||
"functionName": "addEventListener" | ||
} ] | ||
) | ||
} | ||
|
||
static emitMockEvent(state: "blur" | "focus"): void { | ||
Stub.runConditionally( | ||
() => { | ||
throw new Error("It is impossible to emit mock events in non-test environments.") | ||
}, | ||
() => { | ||
this.rawListeners.forEach(rawListener => rawListener(state)) | ||
|
||
return [ {} as unknown as void, null ] | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.