ViewModelCache

Source
import { ViewModelCache } from "@prestojs/viewmodel";
ViewModelCache<ViewModelClassType>

API

Constructor

new ViewModelCache(viewModel)
Source

Arguments:

ArgumentTypeDescription
*viewModelViewModelClassType

Methods

add(...)

Documentation for each typescript overload shown below:

add<T>(data)
Source

Arguments:

ArgumentTypeDescription
*dataT
Returns:T
add<FieldNames>(data)
Source

Arguments:

ArgumentTypeDescription
*datamapped
addList(...)

Documentation for each typescript overload shown below:

addList<T>(records)
Source

Arguments:

ArgumentTypeDescription
*recordsT[]
Returns:T[]
addList<FieldNames>(records)
Source

Arguments:

ArgumentTypeDescription
*recordsmapped[]
addListener(...)

Documentation for each typescript overload shown below:

addListener(listener)
Source

Arguments:

ArgumentTypeDescription
*listener() => void
Returns:() => void
addListener<T>(pk,fieldNames,listener,?batch)
Source

Arguments:

ArgumentTypeDescription
*pkPkType
*fieldNamesT[]
*listener(previous?: T | null | undefined, next?: T | null | undefined) => void
batchboolean
Returns:() => void
addListener<T>(pks,fieldNames,listener,?batch)
Source

Arguments:

ArgumentTypeDescription
*pksPkType[]
*fieldNamesT[]
*listener(previous?: (T | null)[] | undefined, next?: (T | null)[] | undefined) => void
batchboolean
Returns:() => void
addListenerList(...)

Documentation for each typescript overload shown below:

addListenerList<T>(pks,fieldNames,listener)
Source

Arguments:

ArgumentTypeDescription
*pksPkType[]
*fieldNamesT[]
*listener(previous?: (T | null)[] | undefined, next?: (T | null)[] | undefined) => void
Returns:() => void
batch<T>(run)
Source

Arguments:

ArgumentTypeDescription
*run
Returns:T
delete(pk,?fieldNames)
Source

Arguments:

ArgumentTypeDescription
*pkPkType
fieldNames'*'|[string|string[]][]
Returns:boolean
deleteAll(?fieldNames)
Source

Arguments:

ArgumentTypeDescription
fieldNames'*'|[string|string[]][]
Returns:void
get(...)

Documentation for each typescript overload shown below:

get<T>(pk,fieldNames)
Source

Arguments:

ArgumentTypeDescription
*pkPkType
*fieldNamesT[]
Returns:null|PartialViewModel
get<T>(record)
Source

Arguments:

ArgumentTypeDescription
*recordPartialViewModel
Returns:null|PartialViewModel
getAll(...)

Documentation for each typescript overload shown below:

getAll(fieldNames)
Source

Arguments:

ArgumentTypeDescription
*fieldNames"*"
getAll<T>(fieldNames)
Source

Arguments:

ArgumentTypeDescription
*fieldNamesT[]
getList(...)

Documentation for each typescript overload shown below:

getList<T,RemoveNullsT = true>(pks,fieldNames,?removeNulls)
Source

Arguments:

ArgumentTypeDescription
*pksPkType[]
*fieldNamesT[]
removeNullsRemoveNullsT
getList<T,RemoveNullsT = true>(records,?removeNulls)
Source

Arguments:

ArgumentTypeDescription
*recordsT[]
removeNullsRemoveNullsT
Returns:T[]|(null|T)[]

Properties

viewModel

Source
ViewModelClassType