Skip to main content
Version: 1.x

Class: SettingsService

molecule.SettingsService

Hierarchy

Implements

Constructors

constructor

new SettingsService()

Overrides

GlobalEvent.constructor

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

NameType
settingsISettings

Returns

void

Implementation of

ISettingsService.append

Defined in

services/settingsService.ts:130


applySettings

applySettings(nextSettings): void

Apply the nextSettings configuration

Parameters

NameType
nextSettingsISettings

Returns

void

Implementation of

ISettingsService.applySettings

Defined in

services/settingsService.ts:139


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Inherited from

GlobalEvent.count

Defined in

common/event/eventBus.ts:28


emit

emit(name, ...args): void

Emit the service event

Parameters

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns

void

Inherited from

GlobalEvent.emit

Defined in

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

NameType
objobject

Returns

object

Implementation of

ISettingsService.flatObject

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

NameType
objobject

Returns

string

Implementation of

ISettingsService.flatObject2JSONString

Defined in

services/settingsService.ts:178


getBuiltInSettings

Private getBuiltInSettings(): ISettings

Returns

ISettings

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

ISettings

Implementation of

ISettingsService.getSettings

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

NameType
TISettings

Parameters

NameType
jsonStrstring

Returns

T

T

Implementation of

ISettingsService.normalizeFlatObject

Defined in

services/settingsService.ts:163


onChangeSettings

onChangeSettings(callback): void

Listen to the Settings change event.

Parameters

NameType
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

NameTypeDescription
namestring | string[]Event name
listenerFunctionListener function

Returns

void

Inherited from

GlobalEvent.subscribe

Defined in

common/event/eventBus.ts:11


toJSONString

toJSONString(obj, space?): string

It converts an object to JSON string

Parameters

NameTypeDefault value
objobjectundefined
spacenumber4

Returns

string

Implementation of

ISettingsService.toJSONString

Defined in

services/settingsService.ts:182


unsubscribe

unsubscribe(name, listener?): void

Unsubscribe the specific event and the listener function

Parameters

NameTypeDescription
nameanyThe event name
listener?Functionoptional, it unsubscribes events via name if not pass the listener function

Returns

void

Inherited from

GlobalEvent.unsubscribe

Defined in

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

NameType
settingsISettings

Returns

void

Implementation of

ISettingsService.update

Defined in

services/settingsService.ts:124