Skip to content

# Class: TerminalStore

Renderer.Component.TerminalStore

## Hierarchy

- Singleton

↳ TerminalStore

## Table of contents

### Constructors

- constructor

### Properties

- connections
- terminals

### Methods

- connect
- disconnect
- getTerminal
- isConnected
- isDisconnected
- reconnect
- reset
- sendCommand
- createInstance
- getInstance
- resetInstance

## Constructors

### constructor

• new TerminalStore()

#### Overrides

Singleton.constructor

## Properties

### connections

• `Protected` connections: `ObservableMap`<string, TerminalApi>

### terminals

• `Protected` terminals: `Map`<string, Terminal>

## Methods

### connect

▸ connect(`tabId`): `void`

#### Parameters

Name | Type
--- | ---
`tabId` | `string`

#### Returns

`void`

### disconnect

▸ disconnect(`tabId`): `void`

#### Parameters

Name | Type
--- | ---
`tabId` | `string`

#### Returns

`void`

### getTerminal

▸ getTerminal(`tabId`): `Terminal`

#### Parameters

Name | Type
--- | ---
`tabId` | `string`

#### Returns

`Terminal`

### isConnected

▸ isConnected(`tabId`): `boolean`

#### Parameters

Name | Type
--- | ---
`tabId` | `string`

#### Returns

`boolean`

### isDisconnected

▸ isDisconnected(`tabId`): `boolean`

#### Parameters

Name | Type
--- | ---
`tabId` | `string`

#### Returns

`boolean`

### reconnect

▸ reconnect(`tabId`): `void`

#### Parameters

Name | Type
--- | ---
`tabId` | `string`

#### Returns

`void`

### reset

▸ reset(): `void`

#### Returns

`void`

### sendCommand

▸ sendCommand(`command`, `options?`): `Promise`<void>

#### Parameters

Name | Type
--- | ---
`command` | `string`
`options` | `Object`
`options.enter?` | `boolean`
`options.newTab?` | `boolean`
`options.tabId?` | `string`

#### Returns

`Promise`<void>

### createInstance

▸ `Static` createInstance<T, R>(...`args`): `T`

Creates the single instance of the child class if one was not already created.

Multiple calls will return the same instance. Essentially throwing away the arguments to the subsequent calls.

Note: this is a racy function, if two (or more) calls are racing to call this function only the first's arguments will be used.

#### Type parameters

Name | Type
--- | ---
`T` | `T`
`R` | `R`: `any`[]

#### Parameters

Name | Type | Description
--- | --- | ---
`...args` | `R` | The constructor arguments for the child class

#### Returns

`T`

An instance of the child class

#### Inherited from

Singleton.createInstance

### getInstance

▸ `Static` getInstance<T, R>(`strict`): `T`

Get the instance of the child class that was previously created.

#### Type parameters

Name | Type
--- | ---
`T` | `T`
`R` | `R`: `any`[]

#### Parameters

Name | Type | Description
--- | --- | ---
`strict` | `boolean` | If false will return `undefined` instead of throwing when an instance doesn't exist. Default: `true`

#### Returns

`T`

An instance of the child class

#### Inherited from

Singleton.getInstance

### resetInstance

▸ `Static` resetInstance(): `void`

Delete the instance of the child class.

Note: this doesn't prevent callers of `getInstance` from storing the result in a global.

There is no way in JS or TS to prevent globals like that.

#### Returns

`void`

#### Inherited from

Singleton.resetInstance