MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / onGot

Method onGot

packages/core/src/engine/editor.ts:101–113  ·  view source on GitHub ↗
(
    keyOrType: KeyOrType,
    fn: (data: EditorGetResult<T, KeyOrType>) => void,
  )

Source from the content-addressed store, hash-verified

99 */
100 @action
101 onGot<T = undefined, KeyOrType extends EditorValueKey = any>(
102 keyOrType: KeyOrType,
103 fn: (data: EditorGetResult<T, KeyOrType>) => void,
104 ): () => void {
105 const x = this.context.get(keyOrType)
106 if (x !== undefined) {
107 fn(x)
108 }
109 this.setWait(keyOrType, fn)
110 return () => {
111 this.delWait(keyOrType, fn)
112 }
113 }
114
115 /**
116 * listen value when value is changed

Callers

nothing calls this directly

Calls 3

setWaitMethod · 0.95
delWaitMethod · 0.95
getMethod · 0.65

Tested by

no test coverage detected