fix: mixin

This commit is contained in:
cha0s 2024-01-05 22:49:48 -06:00
parent 9dc84ba910
commit 4c7e83a53e
6 changed files with 20 additions and 18 deletions

View File

@ -49,7 +49,7 @@ export default (flecks) => {
}
return {
[Populated]: true,
...flecks.avocado.behavior,
...flecks.avocado.behavior.globals,
...locals,
};
}

View File

@ -36,7 +36,7 @@ it('can add and remove traits', async () => {
}
};
flecks.avocado.traits.Traits['TestTrait'] = TestTrait;
flecks.avocado.traits.Traits.TestTrait = TestTrait;
await entity.addTrait('TestTrait');
expect(entity.is('TestTrait')).to.be.true;
entity.removeTrait('TestTrait');
@ -55,7 +55,7 @@ it('can add traits asynchronously', async () => {
}
}
flecks.avocado.traits.Traits['Async'] = AsyncTrait;
flecks.avocado.traits.Traits.Async = AsyncTrait;
const start = Date.now();
await Entity.load({
traits: {
@ -95,8 +95,8 @@ it('can invoke hooks', async () => {
}
}
flecks.avocado.traits.Traits['AnotherTrait'] = AnotherTrait;
flecks.avocado.traits.Traits['YetAnotherTrait'] = YetAnotherTrait;
flecks.avocado.traits.Traits.AnotherTrait = AnotherTrait;
flecks.avocado.traits.Traits.YetAnotherTrait = YetAnotherTrait;
const entity = new Entity();
await entity.addTrait('AnotherTrait');
await entity.addTrait('YetAnotherTrait');

View File

@ -1,4 +1,3 @@
import Renderer from '@avocado/graphics/renderer';
import {Vector} from '@avocado/math';
import {
forwardRef,
@ -130,7 +129,7 @@ const Stage = forwardRef(({
Stage.defaultProps = {
centered: true,
renderer: new Renderer([0, 0]),
renderer: undefined,
scale: 1,
styles: {
canvas: '',

View File

@ -33,9 +33,10 @@ export const hooks = {
if (!this.avocado.resource) {
this.avocado.resource = {};
}
this.avocado.resource.persea = {
Controllers: {},
};
if (!this.avocado.resource.persea) {
this.avocado.resource.persea = {};
}
this.avocado.resource.persea.Controllers = {};
}
}
@ -49,7 +50,7 @@ export const hooks = {
TextController,
BinaryController,
);
this.avocado.resource.persea.Controllers = Controllers;
flecks.avocado.resource.persea.Controllers = Controllers;
},
'@flecks/redux.reducers': () => reducer,
};

View File

@ -10,9 +10,10 @@ export const hooks = {
if (!this.avocado) {
this.avocado = {};
}
this.avocado.traits = {
Traits: {},
};
if (!this.avocado.traits) {
this.avocado.traits = {};
}
this.avocado.traits.Traits = {};
}
}

View File

@ -1,6 +1,6 @@
export const hooks = {
'@flecks/core.mixin': (Flecks) => (
class FlecksWithAvocadoTraitrs extends Flecks {
class FlecksWithAvocadoTraits extends Flecks {
constructor(...args) {
super(...args);
@ -10,9 +10,10 @@ export const hooks = {
if (!this.avocado.traits) {
this.avocado.traits = {};
}
this.avocado.traits.persea = {
Components: {},
};
if (!this.avocado.traits.persea) {
this.avocado.traits.persea = {};
}
this.avocado.traits.persea.Components = {};
}
}