@xterm/xterm 5.6.0-beta.5 → 5.6.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/css/xterm.css +71 -4
- package/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +53 -0
- package/lib/xterm.mjs.map +7 -0
- package/package.json +40 -31
- package/src/browser/AccessibilityManager.ts +53 -25
- package/src/browser/{Terminal.ts → CoreBrowserTerminal.ts} +132 -144
- package/src/browser/Linkifier.ts +15 -13
- package/src/browser/LocalizableStrings.ts +15 -4
- package/src/browser/{Types.d.ts → Types.ts} +67 -15
- package/src/browser/Viewport.ts +142 -364
- package/src/browser/decorations/BufferDecorationRenderer.ts +14 -9
- package/src/browser/decorations/OverviewRulerRenderer.ts +40 -44
- package/src/browser/public/Terminal.ts +25 -19
- package/src/browser/renderer/dom/DomRenderer.ts +14 -16
- package/src/browser/renderer/shared/CharAtlasUtils.ts +4 -0
- package/src/browser/renderer/shared/CustomGlyphs.ts +6 -0
- package/src/browser/renderer/shared/DevicePixelObserver.ts +1 -2
- package/src/browser/renderer/shared/TextureAtlas.ts +3 -3
- package/src/browser/renderer/shared/{Types.d.ts → Types.ts} +4 -4
- package/src/browser/services/CharSizeService.ts +6 -6
- package/src/browser/services/CoreBrowserService.ts +15 -15
- package/src/browser/services/LinkProviderService.ts +2 -2
- package/src/browser/services/RenderService.ts +20 -20
- package/src/browser/services/SelectionService.ts +8 -8
- package/src/browser/services/Services.ts +13 -13
- package/src/browser/services/ThemeService.ts +17 -56
- package/src/browser/shared/Constants.ts +8 -0
- package/src/common/CircularList.ts +5 -5
- package/src/common/CoreTerminal.ts +35 -41
- package/src/common/InputHandler.ts +34 -28
- package/src/common/{Types.d.ts → Types.ts} +11 -17
- package/src/common/buffer/Buffer.ts +5 -1
- package/src/common/buffer/BufferSet.ts +5 -5
- package/src/common/buffer/Marker.ts +4 -4
- package/src/common/buffer/{Types.d.ts → Types.ts} +2 -2
- package/src/common/input/WriteBuffer.ts +3 -3
- package/src/common/parser/EscapeSequenceParser.ts +4 -4
- package/src/common/public/BufferNamespaceApi.ts +3 -3
- package/src/common/services/BufferService.ts +7 -7
- package/src/common/services/CoreMouseService.ts +5 -3
- package/src/common/services/CoreService.ts +6 -6
- package/src/common/services/DecorationService.ts +8 -9
- package/src/common/services/LogService.ts +2 -2
- package/src/common/services/OptionsService.ts +5 -5
- package/src/common/services/Services.ts +24 -17
- package/src/common/services/UnicodeService.ts +2 -2
- package/src/vs/base/browser/browser.ts +141 -0
- package/src/vs/base/browser/canIUse.ts +49 -0
- package/src/vs/base/browser/dom.ts +2369 -0
- package/src/vs/base/browser/fastDomNode.ts +316 -0
- package/src/vs/base/browser/globalPointerMoveMonitor.ts +112 -0
- package/src/vs/base/browser/iframe.ts +135 -0
- package/src/vs/base/browser/keyboardEvent.ts +213 -0
- package/src/vs/base/browser/mouseEvent.ts +229 -0
- package/src/vs/base/browser/touch.ts +372 -0
- package/src/vs/base/browser/ui/scrollbar/abstractScrollbar.ts +303 -0
- package/src/vs/base/browser/ui/scrollbar/horizontalScrollbar.ts +114 -0
- package/src/vs/base/browser/ui/scrollbar/scrollableElement.ts +720 -0
- package/src/vs/base/browser/ui/scrollbar/scrollableElementOptions.ts +165 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarArrow.ts +114 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarState.ts +243 -0
- package/src/vs/base/browser/ui/scrollbar/scrollbarVisibilityController.ts +118 -0
- package/src/vs/base/browser/ui/scrollbar/verticalScrollbar.ts +116 -0
- package/src/vs/base/browser/ui/widget.ts +57 -0
- package/src/vs/base/browser/window.ts +14 -0
- package/src/vs/base/common/arrays.ts +887 -0
- package/src/vs/base/common/arraysFind.ts +202 -0
- package/src/vs/base/common/assert.ts +71 -0
- package/src/vs/base/common/async.ts +1992 -0
- package/src/vs/base/common/cancellation.ts +148 -0
- package/src/vs/base/common/charCode.ts +450 -0
- package/src/vs/base/common/collections.ts +140 -0
- package/src/vs/base/common/decorators.ts +130 -0
- package/src/vs/base/common/equals.ts +146 -0
- package/src/vs/base/common/errors.ts +303 -0
- package/src/vs/base/common/event.ts +1778 -0
- package/src/vs/base/common/functional.ts +32 -0
- package/src/vs/base/common/hash.ts +316 -0
- package/src/vs/base/common/iterator.ts +159 -0
- package/src/vs/base/common/keyCodes.ts +526 -0
- package/src/vs/base/common/keybindings.ts +284 -0
- package/src/vs/base/common/lazy.ts +47 -0
- package/src/vs/base/common/lifecycle.ts +801 -0
- package/src/vs/base/common/linkedList.ts +142 -0
- package/src/vs/base/common/map.ts +202 -0
- package/src/vs/base/common/numbers.ts +98 -0
- package/src/vs/base/common/observable.ts +76 -0
- package/src/vs/base/common/observableInternal/api.ts +31 -0
- package/src/vs/base/common/observableInternal/autorun.ts +281 -0
- package/src/vs/base/common/observableInternal/base.ts +489 -0
- package/src/vs/base/common/observableInternal/debugName.ts +145 -0
- package/src/vs/base/common/observableInternal/derived.ts +428 -0
- package/src/vs/base/common/observableInternal/lazyObservableValue.ts +146 -0
- package/src/vs/base/common/observableInternal/logging.ts +328 -0
- package/src/vs/base/common/observableInternal/promise.ts +209 -0
- package/src/vs/base/common/observableInternal/utils.ts +610 -0
- package/src/vs/base/common/platform.ts +281 -0
- package/src/vs/base/common/scrollable.ts +522 -0
- package/src/vs/base/common/sequence.ts +34 -0
- package/src/vs/base/common/stopwatch.ts +43 -0
- package/src/vs/base/common/strings.ts +557 -0
- package/src/vs/base/common/symbols.ts +9 -0
- package/src/vs/base/common/uint.ts +59 -0
- package/src/vs/patches/nls.ts +90 -0
- package/src/vs/typings/base-common.d.ts +20 -0
- package/src/vs/typings/require.d.ts +42 -0
- package/src/vs/typings/thenable.d.ts +12 -0
- package/src/vs/typings/vscode-globals-nls.d.ts +36 -0
- package/src/vs/typings/vscode-globals-product.d.ts +33 -0
- package/typings/xterm.d.ts +59 -15
- package/src/browser/Lifecycle.ts +0 -33
- package/src/common/EventEmitter.ts +0 -78
- package/src/common/Lifecycle.ts +0 -108
- /package/src/browser/selection/{Types.d.ts → Types.ts} +0 -0
- /package/src/common/parser/{Types.d.ts → Types.ts} +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
import { illegalArgument } from 'vs/base/common/errors';
|
|
7
|
+
import { KeyCode, ScanCode } from 'vs/base/common/keyCodes';
|
|
8
|
+
import { OperatingSystem } from 'vs/base/common/platform';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Binary encoding strategy:
|
|
12
|
+
* ```
|
|
13
|
+
* 1111 11
|
|
14
|
+
* 5432 1098 7654 3210
|
|
15
|
+
* ---- CSAW KKKK KKKK
|
|
16
|
+
* C = bit 11 = ctrlCmd flag
|
|
17
|
+
* S = bit 10 = shift flag
|
|
18
|
+
* A = bit 9 = alt flag
|
|
19
|
+
* W = bit 8 = winCtrl flag
|
|
20
|
+
* K = bits 0-7 = key code
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
const enum BinaryKeybindingsMask {
|
|
24
|
+
CtrlCmd = (1 << 11) >>> 0,
|
|
25
|
+
Shift = (1 << 10) >>> 0,
|
|
26
|
+
Alt = (1 << 9) >>> 0,
|
|
27
|
+
WinCtrl = (1 << 8) >>> 0,
|
|
28
|
+
KeyCode = 0x000000FF
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function decodeKeybinding(keybinding: number | number[], OS: OperatingSystem): Keybinding | null {
|
|
32
|
+
if (typeof keybinding === 'number') {
|
|
33
|
+
if (keybinding === 0) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const firstChord = (keybinding & 0x0000FFFF) >>> 0;
|
|
37
|
+
const secondChord = (keybinding & 0xFFFF0000) >>> 16;
|
|
38
|
+
if (secondChord !== 0) {
|
|
39
|
+
return new Keybinding([
|
|
40
|
+
createSimpleKeybinding(firstChord, OS),
|
|
41
|
+
createSimpleKeybinding(secondChord, OS)
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
return new Keybinding([createSimpleKeybinding(firstChord, OS)]);
|
|
45
|
+
} else {
|
|
46
|
+
const chords = [];
|
|
47
|
+
for (let i = 0; i < keybinding.length; i++) {
|
|
48
|
+
chords.push(createSimpleKeybinding(keybinding[i], OS));
|
|
49
|
+
}
|
|
50
|
+
return new Keybinding(chords);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function createSimpleKeybinding(keybinding: number, OS: OperatingSystem): KeyCodeChord {
|
|
55
|
+
|
|
56
|
+
const ctrlCmd = (keybinding & BinaryKeybindingsMask.CtrlCmd ? true : false);
|
|
57
|
+
const winCtrl = (keybinding & BinaryKeybindingsMask.WinCtrl ? true : false);
|
|
58
|
+
|
|
59
|
+
const ctrlKey = (OS === OperatingSystem.Macintosh ? winCtrl : ctrlCmd);
|
|
60
|
+
const shiftKey = (keybinding & BinaryKeybindingsMask.Shift ? true : false);
|
|
61
|
+
const altKey = (keybinding & BinaryKeybindingsMask.Alt ? true : false);
|
|
62
|
+
const metaKey = (OS === OperatingSystem.Macintosh ? ctrlCmd : winCtrl);
|
|
63
|
+
const keyCode = (keybinding & BinaryKeybindingsMask.KeyCode);
|
|
64
|
+
|
|
65
|
+
return new KeyCodeChord(ctrlKey, shiftKey, altKey, metaKey, keyCode);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface Modifiers {
|
|
69
|
+
readonly ctrlKey: boolean;
|
|
70
|
+
readonly shiftKey: boolean;
|
|
71
|
+
readonly altKey: boolean;
|
|
72
|
+
readonly metaKey: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Represents a chord which uses the `keyCode` field of keyboard events.
|
|
77
|
+
* A chord is a combination of keys pressed simultaneously.
|
|
78
|
+
*/
|
|
79
|
+
export class KeyCodeChord implements Modifiers {
|
|
80
|
+
|
|
81
|
+
constructor(
|
|
82
|
+
public readonly ctrlKey: boolean,
|
|
83
|
+
public readonly shiftKey: boolean,
|
|
84
|
+
public readonly altKey: boolean,
|
|
85
|
+
public readonly metaKey: boolean,
|
|
86
|
+
public readonly keyCode: KeyCode
|
|
87
|
+
) { }
|
|
88
|
+
|
|
89
|
+
public equals(other: Chord): boolean {
|
|
90
|
+
return (
|
|
91
|
+
other instanceof KeyCodeChord
|
|
92
|
+
&& this.ctrlKey === other.ctrlKey
|
|
93
|
+
&& this.shiftKey === other.shiftKey
|
|
94
|
+
&& this.altKey === other.altKey
|
|
95
|
+
&& this.metaKey === other.metaKey
|
|
96
|
+
&& this.keyCode === other.keyCode
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public getHashCode(): string {
|
|
101
|
+
const ctrl = this.ctrlKey ? '1' : '0';
|
|
102
|
+
const shift = this.shiftKey ? '1' : '0';
|
|
103
|
+
const alt = this.altKey ? '1' : '0';
|
|
104
|
+
const meta = this.metaKey ? '1' : '0';
|
|
105
|
+
return `K${ctrl}${shift}${alt}${meta}${this.keyCode}`;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public isModifierKey(): boolean {
|
|
109
|
+
return (
|
|
110
|
+
this.keyCode === KeyCode.Unknown
|
|
111
|
+
|| this.keyCode === KeyCode.Ctrl
|
|
112
|
+
|| this.keyCode === KeyCode.Meta
|
|
113
|
+
|| this.keyCode === KeyCode.Alt
|
|
114
|
+
|| this.keyCode === KeyCode.Shift
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public toKeybinding(): Keybinding {
|
|
119
|
+
return new Keybinding([this]);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
|
|
124
|
+
*/
|
|
125
|
+
public isDuplicateModifierCase(): boolean {
|
|
126
|
+
return (
|
|
127
|
+
(this.ctrlKey && this.keyCode === KeyCode.Ctrl)
|
|
128
|
+
|| (this.shiftKey && this.keyCode === KeyCode.Shift)
|
|
129
|
+
|| (this.altKey && this.keyCode === KeyCode.Alt)
|
|
130
|
+
|| (this.metaKey && this.keyCode === KeyCode.Meta)
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Represents a chord which uses the `code` field of keyboard events.
|
|
137
|
+
* A chord is a combination of keys pressed simultaneously.
|
|
138
|
+
*/
|
|
139
|
+
export class ScanCodeChord implements Modifiers {
|
|
140
|
+
|
|
141
|
+
constructor(
|
|
142
|
+
public readonly ctrlKey: boolean,
|
|
143
|
+
public readonly shiftKey: boolean,
|
|
144
|
+
public readonly altKey: boolean,
|
|
145
|
+
public readonly metaKey: boolean,
|
|
146
|
+
public readonly scanCode: ScanCode
|
|
147
|
+
) { }
|
|
148
|
+
|
|
149
|
+
public equals(other: Chord): boolean {
|
|
150
|
+
return (
|
|
151
|
+
other instanceof ScanCodeChord
|
|
152
|
+
&& this.ctrlKey === other.ctrlKey
|
|
153
|
+
&& this.shiftKey === other.shiftKey
|
|
154
|
+
&& this.altKey === other.altKey
|
|
155
|
+
&& this.metaKey === other.metaKey
|
|
156
|
+
&& this.scanCode === other.scanCode
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public getHashCode(): string {
|
|
161
|
+
const ctrl = this.ctrlKey ? '1' : '0';
|
|
162
|
+
const shift = this.shiftKey ? '1' : '0';
|
|
163
|
+
const alt = this.altKey ? '1' : '0';
|
|
164
|
+
const meta = this.metaKey ? '1' : '0';
|
|
165
|
+
return `S${ctrl}${shift}${alt}${meta}${this.scanCode}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Does this keybinding refer to the key code of a modifier and it also has the modifier flag?
|
|
170
|
+
*/
|
|
171
|
+
public isDuplicateModifierCase(): boolean {
|
|
172
|
+
return (
|
|
173
|
+
(this.ctrlKey && (this.scanCode === ScanCode.ControlLeft || this.scanCode === ScanCode.ControlRight))
|
|
174
|
+
|| (this.shiftKey && (this.scanCode === ScanCode.ShiftLeft || this.scanCode === ScanCode.ShiftRight))
|
|
175
|
+
|| (this.altKey && (this.scanCode === ScanCode.AltLeft || this.scanCode === ScanCode.AltRight))
|
|
176
|
+
|| (this.metaKey && (this.scanCode === ScanCode.MetaLeft || this.scanCode === ScanCode.MetaRight))
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type Chord = KeyCodeChord | ScanCodeChord;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A keybinding is a sequence of chords.
|
|
185
|
+
*/
|
|
186
|
+
export class Keybinding {
|
|
187
|
+
|
|
188
|
+
public readonly chords: Chord[];
|
|
189
|
+
|
|
190
|
+
constructor(chords: Chord[]) {
|
|
191
|
+
if (chords.length === 0) {
|
|
192
|
+
throw illegalArgument(`chords`);
|
|
193
|
+
}
|
|
194
|
+
this.chords = chords;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
public getHashCode(): string {
|
|
198
|
+
let result = '';
|
|
199
|
+
for (let i = 0, len = this.chords.length; i < len; i++) {
|
|
200
|
+
if (i !== 0) {
|
|
201
|
+
result += ';';
|
|
202
|
+
}
|
|
203
|
+
result += this.chords[i].getHashCode();
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
public equals(other: Keybinding | null): boolean {
|
|
209
|
+
if (other === null) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (this.chords.length !== other.chords.length) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
for (let i = 0; i < this.chords.length; i++) {
|
|
216
|
+
if (!this.chords[i].equals(other.chords[i])) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export class ResolvedChord {
|
|
225
|
+
constructor(
|
|
226
|
+
public readonly ctrlKey: boolean,
|
|
227
|
+
public readonly shiftKey: boolean,
|
|
228
|
+
public readonly altKey: boolean,
|
|
229
|
+
public readonly metaKey: boolean,
|
|
230
|
+
public readonly keyLabel: string | null,
|
|
231
|
+
public readonly keyAriaLabel: string | null
|
|
232
|
+
) { }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export type SingleModifierChord = 'ctrl' | 'shift' | 'alt' | 'meta';
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* A resolved keybinding. Consists of one or multiple chords.
|
|
239
|
+
*/
|
|
240
|
+
export abstract class ResolvedKeybinding {
|
|
241
|
+
/**
|
|
242
|
+
* This prints the binding in a format suitable for displaying in the UI.
|
|
243
|
+
*/
|
|
244
|
+
public abstract getLabel(): string | null;
|
|
245
|
+
/**
|
|
246
|
+
* This prints the binding in a format suitable for ARIA.
|
|
247
|
+
*/
|
|
248
|
+
public abstract getAriaLabel(): string | null;
|
|
249
|
+
/**
|
|
250
|
+
* This prints the binding in a format suitable for electron's accelerators.
|
|
251
|
+
* See https://github.com/electron/electron/blob/master/docs/api/accelerator.md
|
|
252
|
+
*/
|
|
253
|
+
public abstract getElectronAccelerator(): string | null;
|
|
254
|
+
/**
|
|
255
|
+
* This prints the binding in a format suitable for user settings.
|
|
256
|
+
*/
|
|
257
|
+
public abstract getUserSettingsLabel(): string | null;
|
|
258
|
+
/**
|
|
259
|
+
* Is the user settings label reflecting the label?
|
|
260
|
+
*/
|
|
261
|
+
public abstract isWYSIWYG(): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* Does the keybinding consist of more than one chord?
|
|
264
|
+
*/
|
|
265
|
+
public abstract hasMultipleChords(): boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Returns the chords that comprise of the keybinding.
|
|
268
|
+
*/
|
|
269
|
+
public abstract getChords(): ResolvedChord[];
|
|
270
|
+
/**
|
|
271
|
+
* Returns the chords as strings useful for dispatching.
|
|
272
|
+
* Returns null for modifier only chords.
|
|
273
|
+
* @example keybinding "Shift" -> null
|
|
274
|
+
* @example keybinding ("D" with shift == true) -> "shift+D"
|
|
275
|
+
*/
|
|
276
|
+
public abstract getDispatchChords(): (string | null)[];
|
|
277
|
+
/**
|
|
278
|
+
* Returns the modifier only chords as strings useful for dispatching.
|
|
279
|
+
* Returns null for chords that contain more than one modifier or a regular key.
|
|
280
|
+
* @example keybinding "Shift" -> "shift"
|
|
281
|
+
* @example keybinding ("D" with shift == true") -> null
|
|
282
|
+
*/
|
|
283
|
+
public abstract getSingleModifierDispatchChords(): (SingleModifierChord | null)[];
|
|
284
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
export class Lazy<T> {
|
|
7
|
+
|
|
8
|
+
private _didRun: boolean = false;
|
|
9
|
+
private _value?: T;
|
|
10
|
+
private _error: Error | undefined;
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
private readonly executor: () => T,
|
|
14
|
+
) { }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* True if the lazy value has been resolved.
|
|
18
|
+
*/
|
|
19
|
+
get hasValue() { return this._didRun; }
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get the wrapped value.
|
|
23
|
+
*
|
|
24
|
+
* This will force evaluation of the lazy value if it has not been resolved yet. Lazy values are only
|
|
25
|
+
* resolved once. `getValue` will re-throw exceptions that are hit while resolving the value
|
|
26
|
+
*/
|
|
27
|
+
get value(): T {
|
|
28
|
+
if (!this._didRun) {
|
|
29
|
+
try {
|
|
30
|
+
this._value = this.executor();
|
|
31
|
+
} catch (err) {
|
|
32
|
+
this._error = err;
|
|
33
|
+
} finally {
|
|
34
|
+
this._didRun = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (this._error) {
|
|
38
|
+
throw this._error;
|
|
39
|
+
}
|
|
40
|
+
return this._value!;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the wrapped value without forcing evaluation.
|
|
45
|
+
*/
|
|
46
|
+
get rawValue(): T | undefined { return this._value; }
|
|
47
|
+
}
|