MCPcopy Create free account
hub / github.com/editablejs/editable / getViewerStore

Function getViewerStore

packages/plugins/image/src/store/viewer.ts:10–20  ·  view source on GitHub ↗
(editor: Editor)

Source from the content-addressed store, hash-verified

8const EDITOR_TO_IMAGE_STORE = new WeakMap<Editor, UseBoundStore<StoreApi<ImageViewerStore>>>()
9
10export const getViewerStore = (editor: Editor) => {
11 let store = EDITOR_TO_IMAGE_STORE.get(editor)
12 if (!store) {
13 store = create<ImageViewerStore>(() => ({
14 visible: false,
15 index: 0,
16 }))
17 EDITOR_TO_IMAGE_STORE.set(editor, store)
18 }
19 return store
20}

Callers 2

createViewerFunction · 0.90
useViewerStoreFunction · 0.90

Calls 2

getMethod · 0.80
createFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…