UNPKG

@eclipse-glsp/client

Version:

A sprotty-based client for GLSP

64 lines 3.92 kB
/// <reference types="node" /> /******************************************************************************** * Copyright (c) 2019-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { Action, ActionDispatcher, ActionHandlerRegistry, Deferred, GModelRoot, IActionDispatcher, RequestAction, ResponseAction } from '@eclipse-glsp/sprotty'; import { IGModelRootListener } from './editor-context-service'; import { ModelInitializationConstraint } from './model/model-initialization-constraint'; export declare class GLSPActionDispatcher extends ActionDispatcher implements IGModelRootListener, IActionDispatcher { protected readonly timeouts: Map<string, NodeJS.Timeout>; protected initializedConstraint: boolean; protected initializationConstraint: ModelInitializationConstraint; protected actionHandlerRegistry: ActionHandlerRegistry; /** @deprecated No longer in used. The {@link ActionHandlerRegistry} is now directly injected */ protected actionHandlerRegistryProvider: () => Promise<ActionHandlerRegistry>; protected postUpdateQueue: Action[]; protected initializeDeferred: Deferred<void>; initialize(): Promise<void>; protected doInitialize(): Promise<void>; protected startModelInitialization(): void; onceModelInitialized(): Promise<void>; hasHandler(action: Action): boolean; /** * Processes all given actions, by dispatching them to the corresponding handlers, after the model initialization is completed. * * @param actions The actions that should be dispatched after the model initialization */ dispatchOnceModelInitialized(...actions: Action[]): void; /** * Processes all given actions, by dispatching them to the corresponding handlers, after the next model update. * The given actions are queued until the next model update cycle has been completed i.e. * the `EditorContextService.onModelRootChanged` event is triggered. * * @param actions The actions that should be dispatched after the next model update */ dispatchAfterNextUpdate(...actions: Action[]): void; modelRootChanged(_root: Readonly<GModelRoot>): void; dispatch(action: Action): Promise<void>; protected handleAction(action: Action): Promise<void>; request<Res extends ResponseAction>(action: RequestAction<Res>): Promise<Res>; /** * Dispatch a request and waits for a response until the timeout given in `timeoutMs` has * been reached. The returned promise is resolved when a response with matching identifier * is dispatched or when the timeout has been reached. That response is _not_ passed to the * registered action handlers. Instead, it is the responsibility of the caller of this method * to handle the response properly. For example, it can be sent to the registered handlers by * passing it again to the `dispatch` method. * If `rejectOnTimeout` is set to false (default) the returned promise will be resolved with * no value, otherwise it will be rejected. */ requestUntil<Res extends ResponseAction>(action: RequestAction<Res>, timeoutMs?: number, rejectOnTimeout?: boolean): Promise<Res | undefined>; } //# sourceMappingURL=action-dispatcher.d.ts.map