Refactor event bus and queue system; detect cycles in DI realization and make
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2022-01-26 19:37:54 -06:00
parent 506fb55c74
commit 6d1cf18680
69 changed files with 1673 additions and 720 deletions

View File

@@ -1,31 +1,19 @@
import {Model} from '../Model'
import {Event} from '../../../event/Event'
import {JSONState} from '../../../util'
import {BaseEvent} from '../../../support/bus'
import {Awaitable} from '../../../util'
/**
* Base class for events that concern an instance of a model.
* @fixme support serialization
*/
export abstract class ModelEvent<T extends Model<T>> extends Event {
/**
* The instance of the model.
*/
public instance!: T
export abstract class ModelEvent<T extends Model<T>> extends BaseEvent {
constructor(
instance?: T,
public readonly instance: T,
) {
super()
if ( instance ) {
this.instance = instance
}
}
// TODO implement serialization here
dehydrate(): Promise<JSONState> {
return Promise.resolve({})
}
rehydrate(/* state: JSONState */): void | Promise<void> {
return undefined
shouldBroadcast(): Awaitable<boolean> {
return false
}
}