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

Method setInstance

packages/core/src/simulator/simulator.ts:434–443  ·  view source on GitHub ↗
(docId: string, id: string, instances: ComponentInstance[] | null)

Source from the content-addressed store, hash-verified

432
433 @action
434 setInstance(docId: string, id: string, instances: ComponentInstance[] | null) {
435 if (!Object.prototype.hasOwnProperty.call(this.instancesMap, docId)) {
436 this.instancesMap[docId] = new Map()
437 }
438 if (instances == null) {
439 this.instancesMap[docId].delete(id)
440 } else {
441 this.instancesMap[docId].set(id, instances.slice())
442 }
443 }
444
445 getInstance(docId: string, id: string) {
446 return this.instancesMap[docId]?.get(id)?.[0]

Callers 2

unmountInstanceMethod · 0.80
mountInstanceMethod · 0.80

Calls 2

deleteMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected