| 1 |
/** |
| 2 |
* Copyright (c) 2019 The xterm.js authors. All rights reserved. |
| 3 |
* @license MIT |
| 4 |
*/ |
| 5 |
|
| 6 |
import { ICharsetService } from 'common/services/Services'; |
| 7 |
import { ICharset } from 'common/Types'; |
| 8 |
|
| 9 |
export class CharsetService implements ICharsetService { |
| 10 |
public serviceBrand: any; |
| 11 |
|
| 12 |
public charset: ICharset | undefined; |
| 13 |
public glevel: number = 0; |
| 14 |
|
| 15 |
private _charsets: (ICharset | undefined)[] = []; |
| 16 |
|
| 17 |
public reset(): void { |
| 18 |
this.charset = undefined; |
| 19 |
this._charsets = []; |
| 20 |
this.glevel = 0; |
| 21 |
} |
| 22 |
|
| 23 |
public setgLevel(g: number): void { |
| 24 |
this.glevel = g; |
| 25 |
this.charset = this._charsets[g]; |
| 26 |
} |
| 27 |
|
| 28 |
public setgCharset(g: number, charset: ICharset | undefined): void { |
| 29 |
this._charsets[g] = charset; |
| 30 |
if (this.glevel === g) { |
| 31 |
this.charset = charset; |
| 32 |
} |
| 33 |
} |
| 34 |
} |