14 lines
260 B
JavaScript
14 lines
260 B
JavaScript
|
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);
|
||
|
}
|