Feat/parse invitation

This commit is contained in:
Kuldeep
2026-10-05 12:59:22 +00:00
parent d907946804
commit 0c95b9b2b1
19 changed files with 1008 additions and 386 deletions
+6 -6
View File
@@ -49,10 +49,10 @@ export class EventEmitter<T extends EventMap> {
* @returns An off callback that can be called to stop listening for events.
*/
on<K extends keyof T>(type: K, listener: Listener<T[K]>, debounceMilliseconds: number = 0): OffCallback {
const { cancel, listener: cancellableListener } = this.cancellable(listener);
const { cancel, listener: cancellableListener } = this.#cancellable(listener);
// Create a wrapped listener so that the debounce can be applied.
const wrappedListener = debounceMilliseconds > 0 ? this.debounce(cancellableListener, debounceMilliseconds) : cancellableListener;
const wrappedListener = debounceMilliseconds > 0 ? this.#debounce(cancellableListener, debounceMilliseconds) : cancellableListener;
// If the listeners map does not have the event type, create a new set.
if (!this.#listeners.has(type)) {
@@ -87,10 +87,10 @@ export class EventEmitter<T extends EventMap> {
};
// Create a cancellable listener.
const { cancel, listener: cancellableListener } = this.cancellable(wrappedListener);
const { cancel, listener: cancellableListener } = this.#cancellable(wrappedListener);
// Create a debounced listener.
const debouncedListener = debounceMilliseconds > 0 ? this.debounce(cancellableListener, debounceMilliseconds) : cancellableListener;
const debouncedListener = debounceMilliseconds > 0 ? this.#debounce(cancellableListener, debounceMilliseconds) : cancellableListener;
// If the listeners map does not have the event type, create a new set.
if (!this.#listeners.has(type)) {
@@ -243,7 +243,7 @@ export class EventEmitter<T extends EventMap> {
* @param wait - The wait time in milliseconds.
* @returns The debounced function.
*/
private debounce<K extends keyof T>(func: Listener<T[K]>, wait: number): Listener<T[K]> {
#debounce<K extends keyof T>(func: Listener<T[K]>, wait: number): Listener<T[K]> {
// Create a timeout variable.
let timeout: ReturnType<typeof setTimeout>;
@@ -264,7 +264,7 @@ export class EventEmitter<T extends EventMap> {
* @param func - The function to make cancelable.
* @returns The cancellable function with a cancel method.
*/
private cancellable<K extends keyof T>(func: Listener<T[K]>): { cancel: () => void; listener: Listener<T[K]> } {
#cancellable<K extends keyof T>(func: Listener<T[K]>): { cancel: () => void; listener: Listener<T[K]> } {
let cancelled = false;
return {