跳到主要内容
版本:0.9.0-beta.2

Class: SettingsService

molecule.SettingsService

Hierarchy

Implements

Constructors

constructor

new SettingsService()

Overrides

GlobalEvent.constructor

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

NameType
settingsISettings

Returns

void

Implementation of

ISettingsService.append

Defined in

src/services/settingsService.ts:130


applySettings

applySettings(nextSettings): void

Apply the nextSettings configuration

Parameters

NameType
nextSettingsISettings

Returns

void

Implementation of

ISettingsService.applySettings

Defined in

src/services/settingsService.ts:139


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Inherited from

GlobalEvent.count

Defined in

src/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

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

NameType
objobject

Returns

object

Implementation of

ISettingsService.flatObject

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

NameType
objobject

Returns

string

Implementation of

ISettingsService.flatObject2JSONString

Defined in

src/services/settingsService.ts:178


getBuiltInSettings

Private getBuiltInSettings(): ISettings

Returns

ISettings

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

ISettings

Implementation of

ISettingsService.getSettings

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

NameType
TISettings

Parameters

NameType
jsonStrstring

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

NameType
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

NameTypeDescription
namestring | string[]Event name
callbackFunctionCallback function

Returns

void

Inherited from

GlobalEvent.subscribe

Defined in

src/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

src/services/settingsService.ts:182


unsubscribe

unsubscribe(name): void

Unsubscribe the specific event

Parameters

NameTypeDescription
nameanyThe event name

Returns

void

Inherited from

GlobalEvent.unsubscribe

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

NameType
settingsISettings

Returns

void

Implementation of

ISettingsService.update

Defined in

src/services/settingsService.ts:124