Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 30 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Coverage | 100% |
Changes | 0 |
1 | export interface Theme { |
||
2 | name: string, |
||
3 | isBuildIn: boolean, |
||
4 | url: string |
||
5 | } |
||
6 | |||
7 | interface ThemesDictionary { |
||
8 | [name: string]: Theme |
||
9 | } |
||
10 | |||
11 | export default class ThemesRegistry { |
||
12 | protected registeredThemes: ThemesDictionary; |
||
13 | |||
14 | constructor() { |
||
15 | 5 | this.registeredThemes = {}; |
|
16 | } |
||
17 | |||
18 | registerTheme(theme: Theme) { |
||
19 | 5 | this.registeredThemes[theme.name] = theme; |
|
20 | } |
||
21 | |||
22 | getTheme(name: string): Theme { |
||
23 | 3 | return this.registeredThemes[name] || |
|
24 | { |
||
25 | name: 'Unknown', |
||
26 | isBuildIn: true, |
||
27 | url: 'Themes/Unknown' |
||
28 | }; |
||
29 | } |
||
30 | } |