Class: HistoryModel

January 18, 2022 · View on GitHub

Kui API Documentation - v11.0.0 / @kui-shell/core / HistoryModel

Class: HistoryModel

@kui-shell/core.HistoryModel

A tuple of History entries, one per Tab (as specified by its given uuid)

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new HistoryModel(uuid)

Parameters

NameType
uuidstring

Defined in

packages/core/src/models/history.ts:52

Properties

_cursor

Private _cursor: number

Defined in

packages/core/src/models/history.ts:43


_lines

Private _lines: HistoryLine[]

Defined in

packages/core/src/models/history.ts:42


masterUUID

Static Private masterUUID: string

Facilitate copying master history to new Tabs

Defined in

packages/core/src/models/history.ts:46

Accessors

cursor

get cursor(): number

Returns

number

Defined in

packages/core/src/models/history.ts:98

Methods

add

add(line): number

add a line of repl history

Parameters

NameType
linePick<HistoryLine, "raw">

Returns

number

Defined in

packages/core/src/models/history.ts:147


find

find(filter): HistoryLine

Search the history model

Parameters

NameTypeDescription
filterFilterFunctiona search string, search regexp, or search function

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:226


findIndex

findIndex(filter, startIdx?): number

Search the history model

Parameters

NameTypeDescription
filterstring | RegExp | FilterFunctiona search string, search regexp, or search function
startIdx?numberif undefined or negative, start from the end, otherwise, search backwards from the given index

Returns

number

Defined in

packages/core/src/models/history.ts:199


first

first(): HistoryLine

return to the oldest entry

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:180


guardedChange

Private guardedChange(incr): number

change the cursor, protecting against under- and overflow

Parameters

NameType
incrnumber

Returns

number

Defined in

packages/core/src/models/history.ts:103


key

Private key(uuid?): string

The persistence key for this tab

Parameters

NameType
uuidstring

Returns

string

Defined in

packages/core/src/models/history.ts:85


last

last(): HistoryLine

return to the newest entry

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:186


line

line(idx): HistoryLine

return the given line of history

Parameters

NameType
idxnumber

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:90


lineByIncr

lineByIncr(incr): HistoryLine

Parameters

NameType
incrnumber

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:165


next

next(): HistoryLine

go forward one entry

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:175


previous

previous(): HistoryLine

go back one entry

Returns

HistoryLine

Defined in

packages/core/src/models/history.ts:170


restore

Private restore(uuid?): any

Low-level restore from persistent storage

Parameters

NameType
uuidstring

Returns

any

Defined in

packages/core/src/models/history.ts:124


save

Private save(lines?, uuid?): void

Low-level save to persistent storage

Parameters

NameType
linesHistoryLine[]
uuidstring

Returns

void

Defined in

packages/core/src/models/history.ts:119


slice

slice(start, end?): HistoryLine[]

Parameters

NameType
startnumber
end?number

Returns

HistoryLine[]

Defined in

packages/core/src/models/history.ts:94


update

update(cursor, updateFn): Promise<void>

update a line of repl history -- for async operations

Parameters

NameType
cursornumber
updateFn(line: HistoryLine) => void | Promise<void>

Returns

Promise<void>

Defined in

packages/core/src/models/history.ts:159


wipe

wipe(): boolean

Clear out all history

Returns

boolean

Defined in

packages/core/src/models/history.ts:140