Merge pull request #15415 from overleaf/td-scope-store-and-emitter-fixed

IDE scope store and emitter with fixed PDF URLs

GitOrigin-RevId: 9d33bad8a006bb55714878332f78932538dd8921
This commit is contained in:
Tim Down
2023-10-25 08:05:07 +00:00
committed by Copybot
parent 21514418e5
commit 537673cdf6
23 changed files with 1009 additions and 38 deletions
+1
View File
@@ -0,0 +1 @@
export type Scope = Record<string, any>
@@ -0,0 +1,15 @@
import { IdeEvents } from '@/features/ide-react/create-ide-event-emitter'
export type ScopeEventName = keyof IdeEvents
export interface ScopeEventEmitter {
emit: (
eventName: ScopeEventName,
broadcast: boolean,
...detail: unknown[]
) => void
on: (
eventName: ScopeEventName,
listener: (...args: unknown[]) => void
) => () => void
}
@@ -0,0 +1,11 @@
export interface ScopeValueStore {
// We can't make this generic because get() can always return undefined if
// there is no entry for the path
get: (path: string) => any
set: (path: string, value: unknown) => void
watch: <T>(
path: string,
callback: (newValue: T) => void,
deep: boolean
) => () => void
}