@zxh19890103/wik
Version:
The world-class JavaScript library for building large-scale digital warehouse both on 2D and 3D.
45 lines (44 loc) • 1.36 kB
TypeScript
import { Serializable } from '../../interfaces';
import { WithParent } from '../../interfaces';
import { WithID } from '../../interfaces';
import { WithSnapshot } from '../../mixins/Snapshot';
import { EffectCallReq } from './effect';
import { Core } from './Core.class';
import { IList } from './IList';
export interface Model extends WithID, WithParent<IList<Model>>, Serializable {
$$views: View<Model>[];
remove(): void;
}
export interface View<M extends Model = Model, E extends string = string> {
/**
* if this view is a threejs object3d
*/
id?: number;
/**
* if this view is a reactive leaflet layer
*/
layerId?: string;
/**
* if this view is a native leaflet layer
*/
leafletId?: string;
model: M;
whenInit(): void;
whenUnInit?(): void;
whenEffect?(effect: E): void;
}
export declare abstract class Base<E extends string = string> extends Core<E> implements Model {
readonly id: string;
readonly $$views: View<Base<E>>[];
readonly $$parent: IList<Base<E>>;
abstract fromJSON(d: any): this;
abstract toJSON(): any;
abstract toSnapshot(): any;
remove(): void;
}
export interface Base<E extends string = string> extends WithSnapshot<any> {
/**
* Call an effect responses on views.
*/
reqEffectCall(req: EffectCallReq | string): void;
}