Merge pull request #4322 from Tyriar/4124
Explain object option edge case
This commit is contained in:
Vendored
+15
-2
@@ -712,17 +712,30 @@ declare module 'xterm' {
|
|||||||
readonly modes: IModes;
|
readonly modes: IModes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or sets the terminal options. This supports setting multiple options.
|
* Gets or sets the terminal options. This supports setting multiple
|
||||||
|
* options.
|
||||||
*
|
*
|
||||||
* @example Get a single option
|
* @example Get a single option
|
||||||
* ```ts
|
* ```ts
|
||||||
* console.log(terminal.options.fontSize);
|
* console.log(terminal.options.fontSize);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @example Set a single option
|
* @example Set a single option:
|
||||||
* ```ts
|
* ```ts
|
||||||
* terminal.options.fontSize = 12;
|
* terminal.options.fontSize = 12;
|
||||||
* ```
|
* ```
|
||||||
|
* Note that for options that are object, a new object must be used in order
|
||||||
|
* to take effect as a reference comparison will be done:
|
||||||
|
* ```ts
|
||||||
|
* const newValue = terminal.options.theme;
|
||||||
|
* newValue.background = '#000000';
|
||||||
|
*
|
||||||
|
* // This won't work
|
||||||
|
* terminal.options.theme = newValue;
|
||||||
|
*
|
||||||
|
* // This will work
|
||||||
|
* terminal.options.theme = { ...newValue };
|
||||||
|
* ```
|
||||||
*
|
*
|
||||||
* @example Set multiple options
|
* @example Set multiple options
|
||||||
* ```ts
|
* ```ts
|
||||||
|
|||||||
Reference in New Issue
Block a user