avocado-old/packages/entity/trait/registry.js

14 lines
260 B
JavaScript
Raw Normal View History

const traitRegistry = new Map();
export function registerTrait(Trait) {
traitRegistry.set(Trait.type(), Trait);
}
export function hasTrait(type) {
return traitRegistry.has(type);
}
export function lookupTrait(type) {
return traitRegistry.get(type);
}