Interface: ISettingsService
services.ISettingsService
Table of contents
Methods
- append
- applySettings
- flatObject
- flatObject2JSONString
- getDefaultSettingsTab
- getSettings
- normalizeFlatObject
- onChangeSettings
- onSettingsSaved
- openSettingsInEditor
- saveSettings
- toJSONString
- update
Methods
append
▸ append(settings
): void
Append new Settings object
eg: append({ project: { name: 'example' } })
Parameters
Name | Type | Description |
---|---|---|
settings | ISettings | object |
Returns
void
Defined in
src/services/settingsService.ts:16
applySettings
▸ applySettings(nextSettings
): void
Apply the nextSettings configuration
Parameters
Name | Type |
---|---|
nextSettings | ISettings |
Returns
void
Defined in
src/services/settingsService.ts:58
flatObject
▸ flatObject(obj
): object
It converts an object to a flatted object, eg: { a: { b: 'test' }}, result is : { 'a.b': 'test' }.
Parameters
Name | Type | Description |
---|---|---|
obj | object | object |
Returns
object
Defined in
src/services/settingsService.ts:32
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 | Description |
---|---|---|
obj | object | object |
Returns
string
Defined in
src/services/settingsService.ts:38
getDefaultSettingsTab
▸ getDefaultSettingsTab(): IEditorTab
\<{ language
: string
; value
: string
}>
Get the default Settings Tab object
Returns
IEditorTab
\<{ language
: string
; value
: string
}>
Defined in
src/services/settingsService.ts:69
getSettings
▸ getSettings(): ISettings
Get the settings object
Returns
Defined in
src/services/settingsService.ts:26
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 | Description |
---|---|---|
jsonStr | string | string |
Returns
T
T
Defined in
src/services/settingsService.ts:45
onChangeSettings
▸ onChangeSettings(callback
): void
Listen to the Settings change event.
Parameters
Name | Type |
---|---|
callback | (tab : IEditorTab \<IEditorTab \<{ language : string ; value : string }>>) => void |
Returns
void
Defined in
src/services/settingsService.ts:63
onSettingsSaved
▸ onSettingsSaved(callback
): void
Parameters
Name | Type |
---|---|
callback | (settings : ISettings ) => void |
Returns
void
Defined in
src/services/settingsService.ts:73
openSettingsInEditor
▸ openSettingsInEditor(): void
Open the settings.json
in the Editor Panel
Returns
void
Defined in
src/services/settingsService.ts:53
saveSettings
▸ saveSettings(): void
Returns
void
Defined in
src/services/settingsService.ts:71
toJSONString
▸ toJSONString(obj
, space?
): string
It converts an object to JSON string
Parameters
Name | Type |
---|---|
obj | object |
space? | number |
Returns
string
Defined in
src/services/settingsService.ts:49
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