MCPcopy
hub / github.com/alibaba/lowcode-engine / EngineConfig

Class EngineConfig

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

Source from the content-addressed store, hash-verified

199}
200
201export class EngineConfig implements IEngineConfig {
202 private config: { [key: string]: any } = {};
203
204 private waits = new Map<
205 string,
206 Array<{
207 once?: boolean;
208 resolve: (data: any) => void;
209 }>
210 >();
211
212 /**
213 * used to store preferences
214 *
215 */
216 readonly preference: IPublicModelPreference;
217
218 constructor(config?: { [key: string]: any }) {
219 this.config = config || {};
220 this.preference = new Preference();
221 }
222
223 /**
224 * 判断指定 key 是否有值
225 * @param key
226 */
227 has(key: string): boolean {
228 return this.config[key] !== undefined;
229 }
230
231 /**
232 * 获取指定 key 的值
233 * @param key
234 * @param defaultValue
235 */
236 get(key: string, defaultValue?: any): any {
237 return lodashGet(this.config, key, defaultValue);
238 }
239
240 /**
241 * 设置指定 key 的值
242 * @param key
243 * @param value
244 */
245 set(key: string, value: any) {
246 this.config[key] = value;
247 this.notifyGot(key);
248 }
249
250 /**
251 * 批量设值,set 的对象版本
252 * @param config
253 */
254 setConfig(config: { [key: string]: any }) {
255 if (config) {
256 Object.keys(config).forEach((key) => {
257 this.set(key, config[key]);
258 });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…