MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / onceGot

Method onceGot

packages/editor-core/src/config.ts:295–303  ·  view source on GitHub ↗

* 获取指定 key 的值,若此时还未赋值,则等待,若已有值,则直接返回值 * 注:此函数返回 Promise 实例,只会执行(fullfill)一次 * @param key * @returns

(key: string)

Source from the content-addressed store, hash-verified

293 * @returns
294 */
295 onceGot(key: string): Promise<any> {
296 const val = this.config[key];
297 if (val !== undefined) {
298 return Promise.resolve(val);
299 }
300 return new Promise((resolve) => {
301 this.setWait(key, resolve, true);
302 });
303 }
304
305 /**
306 * 获取指定 key 的值,函数回调模式,若多次被赋值,回调会被多次调用

Callers

nothing calls this directly

Calls 2

setWaitMethod · 0.95
resolveMethod · 0.80

Tested by

no test coverage detected