Merge pull request #4322 from Tyriar/4124

Explain object option edge case
This commit is contained in:
Daniel Imms
2022-12-15 17:06:24 -08:00
committed by GitHub
+15 -2
View File
@@ -712,17 +712,30 @@ declare module 'xterm' {
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
* ```ts
* console.log(terminal.options.fontSize);
* ```
*
* @example Set a single option
* @example Set a single option:
* ```ts
* 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
* ```ts