MCPcopy Create free account
hub / github.com/echoVic/blade-code / getComponentsByType

Method getComponentsByType

src/agent/ComponentManager.ts:200–210  ·  view source on GitHub ↗

* 按类型获取组件

(
    componentClass: new (...args: any[]) => T
  )

Source from the content-addressed store, hash-verified

198 * 按类型获取组件
199 */
200 public getComponentsByType<T extends BaseComponent>(
201 componentClass: new (...args: any[]) => T
202 ): T[] {
203 const result: T[] = [];
204 for (const component of this.components.values()) {
205 if (component instanceof componentClass) {
206 result.push(component as T);
207 }
208 }
209 return result;
210 }
211
212 /**
213 * 搜索组件

Callers 1

demonstrateAdvancedUsageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected