avocado-old/packages/entity/index.hooks.js
2020-06-23 11:19:59 -05:00

28 lines
709 B
JavaScript

export function behaviorTypes() {
return {
entity: (entity) => {
const {allTraits} = require('./trait/registrar');
const Traits = entity
? Object.values(entity.allTraitInstances()).map((instance) => instance.constructor)
: allTraits();
const core = {
children: {
invokeHook: {
type: 'object',
label: 'Invoke hook.',
args: [
['hook', {
type: 'string',
}],
],
},
}
};
return Traits
.reduce((r, T) => ({
...r, children: {...r.children, ...T.behaviorTypes(), ...T.describeState()},
}), core);
},
};
}