UNPKG

@kieler/klighd-core

Version:

Core KLighD diagram visualization with Sprotty

28 lines 1.4 kB
import { IActionHandler, ICommand } from 'sprotty'; import { Action } from 'sprotty-protocol'; type Handler = () => void; /** * Abstract registry which should be used as a base for registries in the container. * A registry is supposed to store extra state that is not the diagram model. * Examples for such state include diagram options or preferences. * * The state should be readonly and can only be changed with an {@link Action}. * This is similar to the flux architecture that is utilized by Sprotty, where a * view dispatches actions, which can change the state, causing the view to react * to the changed state and update. Therefore, every registry implements {@link IActionHandler}. * * Implementations define how their actions are handled and automatically * provide a subscription options for listeners, by extending this base class. * A handled action should call `notifyListeners` to inform them about state changes. * * A registry has to be bound to the actions it is supposed to handle in the DI container. * Sprotty provides a `configureActionHandler` function to simplify this process. */ export declare abstract class Registry implements IActionHandler { private _listeners; abstract handle(action: Action): void | Action | ICommand; onChange(handler: Handler): void; protected notifyListeners(): void; } export {}; //# sourceMappingURL=registry.d.ts.map