Skip to content

Commit

Permalink
feat: added TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
makhnatkin committed Sep 3, 2024
1 parent 69ef8ff commit f790e6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
.DS_Store
node_modules
/lib
/react
/dist
/build
/cache
Expand Down
17 changes: 9 additions & 8 deletions src/lib/extension-load-queue.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import {useEffect, useState} from 'react';

declare global {
interface Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: symbol]: any;
QUEUE_SYMBOL: boolean;
}
}

export type ControllerLoadedCallback<T> = (controller: T) => void;

export const QUEUE_SYMBOL = Symbol.for('queue');
Expand All @@ -25,6 +17,7 @@ export interface CreateLoadQueueArgs<T> {
// so we should place it in a separate top-level file and document it.
export const isBrowser = () => typeof window !== 'undefined' && typeof document !== 'undefined';

// TODO: window casts are weird — fix encounter any issues with declaration merging
export const getScriptStore = <T>(key: symbol): ScriptStore<T> => {
if (isBrowser()) {
(window as Window)[key] = (window as Window)[key] || [];
Expand Down Expand Up @@ -116,3 +109,11 @@ export function useController<T>(store: ScriptStore<T>) {

return controller;
}

declare global {
interface Window {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: symbol]: any; // TODO: sub-optimal, fix any
QUEUE_SYMBOL: boolean;
}
}

0 comments on commit f790e6a

Please sign in to comment.