Create new event with emitter object to simplify code
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
*/
|
||||
|
||||
import { IOptionsService, ITerminalOptions, FontWeight } from 'common/services/Services';
|
||||
import { EventEmitter, IEvent } from 'common/EventEmitter';
|
||||
import { isMac } from 'common/Platform';
|
||||
import { CursorStyle } from 'common/Types';
|
||||
import { initEvent } from 'common/EventEmitter';
|
||||
|
||||
export const DEFAULT_OPTIONS: Readonly<Required<ITerminalOptions>> = {
|
||||
cols: 80,
|
||||
@@ -57,8 +57,7 @@ export class OptionsService implements IOptionsService {
|
||||
public readonly rawOptions: Required<ITerminalOptions>;
|
||||
public options: Required<ITerminalOptions>;
|
||||
|
||||
private readonly _onOptionChange = new EventEmitter<string>();
|
||||
public readonly onOptionChange = this._onOptionChange.event;
|
||||
public readonly onOptionChange = initEvent<string>();
|
||||
|
||||
constructor(options: Partial<ITerminalOptions>) {
|
||||
// set the default value of each option
|
||||
@@ -97,7 +96,7 @@ export class OptionsService implements IOptionsService {
|
||||
// Don't fire an option change event if they didn't change
|
||||
if (this.rawOptions[propName] !== value) {
|
||||
this.rawOptions[propName] = value;
|
||||
this._onOptionChange.fire(propName);
|
||||
this.onOptionChange.fire(propName);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user