mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
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:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user