UNPKG

3.46 kBTypeScriptView Raw
1import { IIterator } from '@lumino/algorithm';
2import { Poll } from '@lumino/polling';
3import { ISignal } from '@lumino/signaling';
4import { ServerConnection } from '..';
5import * as Terminal from './terminal';
6import { BaseManager } from '../basemanager';
7/**
8 * A terminal session manager.
9 */
10export declare class TerminalManager extends BaseManager implements Terminal.IManager {
11 /**
12 * Construct a new terminal manager.
13 */
14 constructor(options?: TerminalManager.IOptions);
15 /**
16 * The server settings of the manager.
17 */
18 readonly serverSettings: ServerConnection.ISettings;
19 /**
20 * Test whether the manager is ready.
21 */
22 get isReady(): boolean;
23 /**
24 * A promise that fulfills when the manager is ready.
25 */
26 get ready(): Promise<void>;
27 /**
28 * A signal emitted when the running terminals change.
29 */
30 get runningChanged(): ISignal<this, Terminal.IModel[]>;
31 /**
32 * A signal emitted when there is a connection failure.
33 */
34 get connectionFailure(): ISignal<this, Error>;
35 /**
36 * Dispose of the resources used by the manager.
37 */
38 dispose(): void;
39 /**
40 * Whether the terminal service is available.
41 */
42 isAvailable(): boolean;
43 connectTo(options: Omit<Terminal.ITerminalConnection.IOptions, 'serverSettings'>): Terminal.ITerminalConnection;
44 /**
45 * Create an iterator over the most recent running terminals.
46 *
47 * @returns A new iterator over the running terminals.
48 */
49 running(): IIterator<Terminal.IModel>;
50 /**
51 * Force a refresh of the running terminals.
52 *
53 * @returns A promise that with the list of running terminals.
54 *
55 * #### Notes
56 * This is intended to be called only in response to a user action,
57 * since the manager maintains its internal state.
58 */
59 refreshRunning(): Promise<void>;
60 /**
61 * Create a new terminal session.
62 *
63 * @param options - The options used to create the terminal.
64 *
65 * @returns A promise that resolves with the terminal connection instance.
66 *
67 * #### Notes
68 * The manager `serverSettings` will be used unless overridden in the
69 * options.
70 */
71 startNew(options?: Terminal.ITerminal.IOptions): Promise<Terminal.ITerminalConnection>;
72 /**
73 * Shut down a terminal session by name.
74 */
75 shutdown(name: string): Promise<void>;
76 /**
77 * Shut down all terminal sessions.
78 *
79 * @returns A promise that resolves when all of the sessions are shut down.
80 */
81 shutdownAll(): Promise<void>;
82 /**
83 * Execute a request to the server to poll running terminals and update state.
84 */
85 protected requestRunning(): Promise<void>;
86 /**
87 * Handle a session starting.
88 */
89 private _onStarted;
90 /**
91 * Handle a session terminating.
92 */
93 private _onDisposed;
94 private _isReady;
95 private _names;
96 private get _models();
97 private _pollModels;
98 private _terminalConnections;
99 private _ready;
100 private _runningChanged;
101 private _connectionFailure;
102}
103/**
104 * The namespace for TerminalManager statics.
105 */
106export declare namespace TerminalManager {
107 /**
108 * The options used to initialize a terminal manager.
109 */
110 interface IOptions extends BaseManager.IOptions {
111 /**
112 * When the manager stops polling the API. Defaults to `when-hidden`.
113 */
114 standby?: Poll.Standby;
115 }
116}