import Component from '@/ecs/component.js'; export default class Emitter extends Component { instanceFromSchema() { const Component = this; return class EmitterInstance extends super.instanceFromSchema() { emitting = {}; id = 0; emit(specification) { Component.markChange(this.entity, 'emit', {[this.id++]: specification}); } }; } mergeDiff(original, update) { const merged = {}; if (update.emit) { merged.emit = { ...original.emit, ...update.emit, } } return merged; } }