diff --git a/packages/behavior/src/index.js b/packages/behavior/src/index.js index 8577a28..d188fad 100644 --- a/packages/behavior/src/index.js +++ b/packages/behavior/src/index.js @@ -12,22 +12,21 @@ export const hooks = { cache.reset(); } }, - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoBehavior extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - this.avocado.behavior = { - globals: {}, - }; - } - - } - ), '@flecks/core.starting': async (flecks) => { flecks.avocado.behavior.globals = flecks.invokeMerge('@avocado/behavior.globals'); }, }; + +export const mixin = (Flecks) => class FlecksWithAvocadoBehavior extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + this.avocado.behavior = { + globals: {}, + }; + } + +}; diff --git a/packages/dialog/src/index.js b/packages/dialog/src/index.js index 045d7e9..dc32c5f 100644 --- a/packages/dialog/src/index.js +++ b/packages/dialog/src/index.js @@ -10,21 +10,6 @@ export const hooks = { Flecks.decorate(require.context('./traits/decorators', false, /\.js$/)) ), '@avocado/traits.traits': Flecks.provide(require.context('./traits', false, /\.js$/)), - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoDialog extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - this.avocado.dialog = { - parser: undefined, - }; - } - - } - ), '@flecks/core.starting': (flecks) => { const dialogFunctions = flecks.invokeMerge('@avocado/dialog.functions'); const resolver = (type) => (dialogFunctions[type] ? dialogFunctions[type] : (i) => i); @@ -42,3 +27,17 @@ export const hooks = { }, '@flecks/socket.packets': Flecks.provide(require.context('./packets', false, /\.js$/)), }; + +export const mixin = (Flecks) => class FlecksWithAvocadoDialog extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + this.avocado.dialog = { + parser: undefined, + }; + } + +}; diff --git a/packages/resource/src/index.js b/packages/resource/src/index.js index 899f655..bd41f07 100644 --- a/packages/resource/src/index.js +++ b/packages/resource/src/index.js @@ -10,22 +10,6 @@ export const hooks = { resourceCache.reset(); } }, - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoResource extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - if (!this.avocado.resource) { - this.avocado.resource = {}; - } - this.avocado.resource.Resources = {}; - } - - } - ), '@flecks/core.starting': (flecks) => { flecks.avocado.resource.Resources = flecks.gather( '@avocado/resource.resources', @@ -36,3 +20,18 @@ export const hooks = { ); }, }; + +export const mixin = (Flecks) => class FlecksWithAvocadoResource extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + if (!this.avocado.resource) { + this.avocado.resource = {}; + } + this.avocado.resource.Resources = {}; + } + +}; diff --git a/packages/resource/src/persea/index.js b/packages/resource/src/persea/index.js index 6de64a4..bec2dff 100644 --- a/packages/resource/src/persea/index.js +++ b/packages/resource/src/persea/index.js @@ -22,25 +22,6 @@ export { }; export const hooks = { - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoResourcePersea extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - if (!this.avocado.resource) { - this.avocado.resource = {}; - } - if (!this.avocado.resource.persea) { - this.avocado.resource.persea = {}; - } - this.avocado.resource.persea.Controllers = {}; - } - - } - ), '@flecks/core.starting': async (flecks) => { const Controllers = ( await flecks.invokeSequentialAsync('@avocado/resource/persea.controllers') @@ -54,3 +35,21 @@ export const hooks = { }, '@flecks/redux.reducers': () => reducer, }; + +export const mixin = (Flecks) => class FlecksWithAvocadoResourcePersea extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + if (!this.avocado.resource) { + this.avocado.resource = {}; + } + if (!this.avocado.resource.persea) { + this.avocado.resource.persea = {}; + } + this.avocado.resource.persea.Controllers = {}; + } + +}; diff --git a/packages/topdown/src/persea/index.js b/packages/topdown/src/persea/index.js index 8b09e2d..50fcca2 100644 --- a/packages/topdown/src/persea/index.js +++ b/packages/topdown/src/persea/index.js @@ -10,24 +10,6 @@ export const hooks = { '@avocado/resource/persea.controllers': () => [ RoomController, ], - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoTopdownPersea extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - if (!this.avocado.topdown) { - this.avocado.topdown = {}; - } - this.avocado.topdown.persea = { - RoomSides: {}, - }; - } - - } - ), '@flecks/core.starting': (flecks) => { flecks.avocado.topdown.persea.RoomSides = flecks.invokeFlat( '@avocado/topdown/persea.room-sides', @@ -38,3 +20,20 @@ export const hooks = { EntitiesSide, ], }; + +export const mixin = (Flecks) => class FlecksWithAvocadoTopdownPersea extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + if (!this.avocado.topdown) { + this.avocado.topdown = {}; + } + this.avocado.topdown.persea = { + RoomSides: {}, + }; + } + +}; diff --git a/packages/traits/src/index.js b/packages/traits/src/index.js index c05cdbe..8d0731f 100644 --- a/packages/traits/src/index.js +++ b/packages/traits/src/index.js @@ -2,23 +2,22 @@ export {default as Trait} from './trait'; export {default as StateProperty} from './state-property'; export const hooks = { - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoTraitrs extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - if (!this.avocado.traits) { - this.avocado.traits = {}; - } - this.avocado.traits.Traits = {}; - } - - } - ), '@flecks/core.starting': (flecks) => { flecks.avocado.traits.Traits = flecks.gather('@avocado/traits.traits'); }, }; + +export const mixin = (Flecks) => class FlecksWithAvocadoTraitrs extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + if (!this.avocado.traits) { + this.avocado.traits = {}; + } + this.avocado.traits.Traits = {}; + } + +}; diff --git a/packages/traits/src/persea/index.js b/packages/traits/src/persea/index.js index 4b45959..93b2067 100644 --- a/packages/traits/src/persea/index.js +++ b/packages/traits/src/persea/index.js @@ -1,26 +1,25 @@ export const hooks = { - '@flecks/core.mixin': (Flecks) => ( - class FlecksWithAvocadoTraits extends Flecks { - - constructor(...args) { - super(...args); - if (!this.avocado) { - this.avocado = {}; - } - if (!this.avocado.traits) { - this.avocado.traits = {}; - } - if (!this.avocado.traits.persea) { - this.avocado.traits.persea = {}; - } - this.avocado.traits.persea.Components = {}; - } - - } - ), '@flecks/core.starting': async (flecks) => { flecks.avocado.traits.persea.Components = flecks.invokeMerge( '@avocado/traits/persea.components', ); }, }; + +export const mixin = (Flecks) => class FlecksWithAvocadoTraits extends Flecks { + + constructor(...args) { + super(...args); + if (!this.avocado) { + this.avocado = {}; + } + if (!this.avocado.traits) { + this.avocado.traits = {}; + } + if (!this.avocado.traits.persea) { + this.avocado.traits.persea = {}; + } + this.avocado.traits.persea.Components = {}; + } + +};