Class: SettingsService
molecule.SettingsService
Hierarchy
↳
SettingsService
Implements
Constructors
constructor
• new SettingsService()
Overrides
Defined in
services/settingsService.ts:97
Properties
builtinService
• Private Readonly builtinService: IBuiltinService
Defined in
services/settingsService.ts:95
colorThemeService
• Private Readonly colorThemeService: IColorThemeService
Defined in
services/settingsService.ts:93
editorService
• Private Readonly editorService: IEditorService
Defined in
services/settingsService.ts:92
localeService
• Private Readonly localeService: ILocaleService
Defined in
services/settingsService.ts:94
settings
• Protected settings: ISettings
Defined in
services/settingsService.ts:91
Methods
append
▸ append(settings): void
Append new Settings object
eg: append({ project: { name: 'example' } })
Parameters
| Name | Type |
|---|---|
settings | ISettings |
Returns
void
Implementation of
Defined in
services/settingsService.ts:130
applySettings
▸ applySettings(nextSettings): void
Apply the nextSettings configuration
Parameters
| Name | Type |
|---|---|
nextSettings | ISettings |
Returns
void
Implementation of
ISettingsService.applySettings
Defined in
services/settingsService.ts:139
count
▸ count(name): number
Count the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Event name |
Returns
number
Inherited from
Defined in
emit
▸ emit(name, ...args): void
Emit the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | Event name |
...args | any | Arguments |
Returns
void
Inherited from
Defined in
flatObject
▸ flatObject(obj): object
It converts an object to a flatted object, eg: { a: { b: 'test' }}, result is : { 'a.b': 'test' }.
Parameters
| Name | Type |
|---|---|
obj | object |
Returns
object
Implementation of
Defined in
services/settingsService.ts:174
flatObject2JSONString
▸ flatObject2JSONString(obj): string
It converts an object to a flatted json string,
eg: { a: { b: 'test' }}, result is : { 'a.b': 'test' }.
Parameters
| Name | Type |
|---|---|
obj | object |
Returns
string
Implementation of
ISettingsService.flatObject2JSONString
Defined in
services/settingsService.ts:178
getBuiltInSettings
▸ Private getBuiltInSettings(): ISettings
Returns
Defined in
services/settingsService.ts:106
getDefaultSettingsTab
▸ getDefaultSettingsTab(): IEditorTab<{ language: string ; value: string }>
Get the default Settings Tab object
Returns
IEditorTab<{ language: string ; value: string }>
Implementation of
ISettingsService.getDefaultSettingsTab
Defined in
services/settingsService.ts:113
getSettings
▸ getSettings(): ISettings
Get the settings object
Returns
Implementation of
Defined in
services/settingsService.ts:134
normalizeFlatObject
▸ normalizeFlatObject<T>(jsonStr): T
It converts a flatted JSON string to a normal object,
eg: { 'a.b': 'test' } result is : { a: { b: 'test' }}.
Type parameters
| Name | Type |
|---|---|
T | ISettings |
Parameters
| Name | Type |
|---|---|
jsonStr | string |
Returns
T
T
Implementation of
ISettingsService.normalizeFlatObject
Defined in
services/settingsService.ts:163
onChangeSettings
▸ onChangeSettings(callback): void
Listen to the Settings change event.
Parameters
| Name | Type |
|---|---|
callback | (tab: IEditorTab<IEditorTab<{ language: string ; value: string }>>) => void |
Returns
void
Implementation of
ISettingsService.onChangeSettings
Defined in
services/settingsService.ts:118
openSettingsInEditor
▸ openSettingsInEditor(): void
Open the settings.json in the Editor Panel
Returns
void
Implementation of
ISettingsService.openSettingsInEditor
Defined in
services/settingsService.ts:153
subscribe
▸ subscribe(name, listener): void
Subscribe the service event
Parameters
| Name | Type | Description |
|---|---|---|
name | string | string[] | Event name |
listener | Function | Listener function |
Returns
void
Inherited from
Defined in
toJSONString
▸ toJSONString(obj, space?): string
It converts an object to JSON string
Parameters
| Name | Type | Default value |
|---|---|---|
obj | object | undefined |
space | number | 4 |
Returns
string
Implementation of
Defined in
services/settingsService.ts:182
unsubscribe
▸ unsubscribe(name, listener?): void
Unsubscribe the specific event and the listener function
Parameters
| Name | Type | Description |
|---|---|---|
name | any | The event name |
listener? | Function | optional, it unsubscribes events via name if not pass the listener function |
Returns
void
Inherited from
Defined in
update
▸ update(settings): void
To update a settings object, it's going to overwrite a settings item if it existed.
Parameters
| Name | Type |
|---|---|
settings | ISettings |
Returns
void