Skip to content

Commit

Permalink
feat: allow custome schema component (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
czizzy authored Jun 8, 2021
1 parent ec7bf10 commit 0f2b5d3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/loader/src/scene-loader/AbilityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ export class AbilityManager {
return { id, key, value };
}

public addRuntimeComponent(componentId: string, component: Component) {
(component as any).id = componentId;
this.abilityMap[componentId] = component;
return component;
}

public get(id: string): Component {
return this.abilityMap[id];
}
Expand All @@ -93,7 +99,7 @@ export class AbilityManager {

const constructor = Parser._components["o3"][type];
if (!constructor) {
throw new Error(`${type} is not defined`);
console.warn(`${type} is not defined`);
}
return constructor;
}
Expand Down

0 comments on commit 0f2b5d3

Please sign in to comment.