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

Class: SearchService

molecule.SearchService

Hierarchy

Implements

Constructors

constructor

new SearchService()

Overrides

Component.constructor

Defined in

src/services/workbench/searchService.ts:100

Properties

builtinService

Private builtinService: IBuiltinService

Defined in

src/services/workbench/searchService.ts:99


state

Protected state: ISearchProps

Implementation of

ISearchService.state

Overrides

Component.state

Defined in

src/services/workbench/searchService.ts:98

Methods

count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Implementation of

ISearchService.count

Inherited from

Component.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

Implementation of

ISearchService.emit

Inherited from

Component.emit

Defined in

src/common/event/eventBus.ts:20


forceUpdate

forceUpdate(): void

Force to update the Component

Returns

void

Implementation of

ISearchService.forceUpdate

Inherited from

Component.forceUpdate

Defined in

src/react/component.ts:79


getState

getState(): ISearchProps

Get the Component state

Returns

ISearchProps

Implementation of

ISearchService.getState

Inherited from

Component.getState

Defined in

src/react/component.ts:83


onChange

onChange(callback): void

Listen to the event about the value of search input changed

Parameters

NameType
callback(value: string, replaceValue: string) => void

Returns

void

Implementation of

ISearchService.onChange

Defined in

src/services/workbench/searchService.ts:233


onReplaceAll

onReplaceAll(callback): void

Listen to the event about replace all text in result

Parameters

NameType
callback() => void

Returns

void

Implementation of

ISearchService.onReplaceAll

Defined in

src/services/workbench/searchService.ts:229


onResultClick

onResultClick(callback): void

Listen to the click event in result data

Parameters

NameType
callback(item: ITreeNodeItemProps<any>, resultData: ITreeNodeItemProps<any>[]) => void

Returns

void

Implementation of

ISearchService.onResultClick

Defined in

src/services/workbench/searchService.ts:254


onSearch

onSearch(callback): void

Listen to the event about going to search result via values or config changed

Parameters

NameType
callback(value: string, replaceValue: string, config: { isCaseSensitive: boolean ; isRegex: boolean ; isWholeWords: boolean ; preserveCase: boolean }) => void

Returns

void

Implementation of

ISearchService.onSearch

Defined in

src/services/workbench/searchService.ts:239


onUpdateState

onUpdateState(callback): void

Listen to the Component state update event

Parameters

NameType
callback(prevState: ISearchProps, nextState: ISearchProps) => void

Returns

void

Implementation of

ISearchService.onUpdateState

Inherited from

Component.onUpdateState

Defined in

src/react/component.ts:71


removeOnUpdateState

removeOnUpdateState(): void

Remove the Component update event listening

Returns

void

Implementation of

ISearchService.removeOnUpdateState

Inherited from

Component.removeOnUpdateState

Defined in

src/react/component.ts:75


render

render(nextState?): void

Initiative notify the component to render the view by the state

Parameters

NameType
nextState?ISearchProps

Returns

void

Implementation of

ISearchService.render

Inherited from

Component.render

Defined in

src/react/component.ts:67


reset

reset(): void

Reset the search input data

Returns

void

Implementation of

ISearchService.reset

Defined in

src/services/workbench/searchService.ts:212


setReplaceValue

setReplaceValue(value?): void

Set replace value for replace input

Parameters

NameType
value?string

Returns

void

Implementation of

ISearchService.setReplaceValue

Defined in

src/services/workbench/searchService.ts:124


setResult

setResult(value?): void

Set result data for searching result

Parameters

NameType
value?ITreeNodeItemProps<any>[]

Returns

void

Implementation of

ISearchService.setResult

Defined in

src/services/workbench/searchService.ts:130


setSearchValue

setSearchValue(value?): void

Set search value for search input

Parameters

NameType
value?string

Returns

void

Implementation of

ISearchService.setSearchValue

Defined in

src/services/workbench/searchService.ts:118


setState

setState(values, callback?): void

Set the state values, and notify the view component to re render

Parameters

NameTypeDescription
valuesPartial<ISearchProps>update target state values
callback?(prevState: ISearchProps, nextState: ISearchProps) => void-

Returns

void

Implementation of

ISearchService.setState

Inherited from

Component.setState

Defined in

src/react/component.ts:54


setValidateInfo

setValidateInfo(info): void

Set informations about validating,

Parameters

NameType
infoundefined | string | { text: string ; type: "warning" | "info" | "error" }

Returns

void

Implementation of

ISearchService.setValidateInfo

Defined in

src/services/workbench/searchService.ts:106


subscribe

subscribe(name, callback): void

Subscribe the service event

Parameters

NameTypeDescription
namestring | string[]Event name
callbackFunctionCallback function

Returns

void

Implementation of

ISearchService.subscribe

Inherited from

Component.subscribe

Defined in

src/common/event/eventBus.ts:11


toggleCaseSensitive

toggleCaseSensitive(): void

Toggle the rule for case senstitive when searching

Returns

void

Implementation of

ISearchService.toggleCaseSensitive

Defined in

src/services/workbench/searchService.ts:142


toggleMode

toggleMode(status): void

Toggle search mode, true for replace mode

Parameters

NameType
statusboolean

Returns

void

Implementation of

ISearchService.toggleMode

Defined in

src/services/workbench/searchService.ts:136


togglePreserveCase

togglePreserveCase(): void

Toggle the rule for preserving case when replacing

Returns

void

Implementation of

ISearchService.togglePreserveCase

Defined in

src/services/workbench/searchService.ts:184


toggleRegex

toggleRegex(): void

Toggle the rule for enabling regex when searching

Returns

void

Implementation of

ISearchService.toggleRegex

Defined in

src/services/workbench/searchService.ts:171


toggleWholeWord

toggleWholeWord(): void

Toggle the rule for finding whole word when searching

Returns

void

Implementation of

ISearchService.toggleWholeWord

Defined in

src/services/workbench/searchService.ts:158


unsubscribe

unsubscribe(name): void

Unsubscribe the specific event

Parameters

NameTypeDescription
nameanyThe event name

Returns

void

Implementation of

ISearchService.unsubscribe

Inherited from

Component.unsubscribe

Defined in

src/common/event/eventBus.ts:37


updateStatus

updateStatus(addonId, checked): void

Update the status of specific addon icon to checked

Parameters

NameType
addonIdstring
checkedboolean

Returns

void

Implementation of

ISearchService.updateStatus

Defined in

src/services/workbench/searchService.ts:197