Class: SettingsService
molecule.SettingsService
Hierarchy
↳
SettingsService
Implements
Constructors
constructor
• new SettingsService()
Overrides
Defined in
src/services/settingsService.ts:97
Properties
builtinService
• Private
Readonly
builtinService: IBuiltinService
Defined in
src/services/settingsService.ts:95
colorThemeService
• Private
Readonly
colorThemeService: IColorThemeService
Defined in
src/services/settingsService.ts:93
editorService
• Private
Readonly
editorService: IEditorService
Defined in
src/services/settingsService.ts:92
localeService
• Private
Readonly
localeService: ILocaleService
Defined in
src/services/settingsService.ts:94
settings
• Protected
settings: ISettings
Defined in
src/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
src/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
src/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
src/common/event/eventBus.ts:28
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
src/common/event/eventBus.ts:20
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
src/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
src/services/settingsService.ts:178
getBuiltInSettings
▸ Private
getBuiltInSettings(): ISettings
Returns
Defined in
src/services/settingsService.ts:106
getDefaultSettingsTab
▸ getDefaultSettingsTab(): IEditorTab
<Object
>
Get the default Settings Tab object
Returns
IEditorTab
<Object
>
Implementation of
ISettingsService.getDefaultSettingsTab
Defined in
src/services/settingsService.ts:113
getSettings
▸ getSettings(): ISettings
Get the settings object
Returns
Implementation of
Defined in
src/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
src/services/settingsService.ts:163
onChangeSettings
▸ onChangeSettings(callback
): void
Listen to the Settings change event.
Parameters
Name | Type |
---|---|
callback | (tab : IEditorTab <IEditorTab <Object >>) => void |
Returns
void
Implementation of
ISettingsService.onChangeSettings
Defined in
src/services/settingsService.ts:118
openSettingsInEditor
▸ openSettingsInEditor(): void
Open the settings.json
in the Editor Panel
Returns
void
Implementation of
ISettingsService.openSettingsInEditor
Defined in
src/services/settingsService.ts:153
subscribe
▸ subscribe(name
, callback
): void
Subscribe the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | string [] | Event name |
callback | Function | Callback function |
Returns
void
Inherited from
Defined in
src/common/event/eventBus.ts:11
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
src/services/settingsService.ts:182
unsubscribe
▸ unsubscribe(name
): void
Unsubscribe the specific event
Parameters
Name | Type | Description |
---|---|---|
name | any | The event name |
Returns
void
Inherited from
Defined in
src/common/event/eventBus.ts:37
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