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

Method notifyGot

packages/core/src/engine/editor.ts:211–229  ·  view source on GitHub ↗

* notify all listeners when value is got

(key: EditorValueKey)

Source from the content-addressed store, hash-verified

209 * notify all listeners when value is got
210 */
211 private notifyGot(key: EditorValueKey) {
212 let waits = this.waits.get(key)
213 if (!waits) {
214 return
215 }
216 waits = waits.slice().reverse()
217 let i = waits.length
218 while (i--) {
219 waits[i].resolve(this.get(key))
220 if (waits[i].once) {
221 waits.splice(i, 1)
222 }
223 }
224 if (waits.length > 0) {
225 this.waits.set(key, waits)
226 } else {
227 this.waits.delete(key)
228 }
229 }
230
231 private setWait(key: EditorValueKey, resolve: (data: any) => void, once?: boolean) {
232 const waits = this.waits.get(key)

Callers 2

setMethod · 0.95
registerMethod · 0.95

Calls 6

getMethod · 0.95
reverseMethod · 0.80
resolveMethod · 0.80
getMethod · 0.65
setMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected