ViewModelCache

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

API

Constructor

new ViewModelCache(viewModel)
Params:
ParameterTypeDescription
*viewModelViewModelClassType

Methods

add<T>(recordOrData)
Params:
ParameterTypeDescription
*recordOrDataT
Returns:T
add<T>(recordOrData)
Params:
ParameterTypeDescription
*recordOrDataT[]
Returns:T[]
add<FieldNames>(recordOrData)
Params:
ParameterTypeDescription
*recordOrDatamapped
add<FieldNames>(recordOrData)
Params:
ParameterTypeDescription
*recordOrDatamapped[]
addList<T>(recordsOrData)
Params:
ParameterTypeDescription
*recordsOrDataT[]
Returns:T[]
addList<FieldNames>(recordsOrData)
Params:
ParameterTypeDescription
*recordsOrDatamapped[]
addListener(listener)
Params:
ParameterTypeDescription
*listenerAllChangesListener
Returns:ChangeListenerUnsubscribe
addListener<T>(pkOrPks,fieldNames,listener,?batch)
Params:
ParameterTypeDescription
*pkOrPksObject|mapped
*fieldNamesT[]
*listenerChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListener(pkOrPks,fieldNames,listener,?batch)
Params:
ParameterTypeDescription
*pkOrPksObject|mapped
*fieldNames"*"
*listenerChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListener<T>(pkOrPks,fieldNames,listener,?batch)
Params:
ParameterTypeDescription
*pkOrPks(Object|mapped)[]
*fieldNamesT[]
*listenerMultiChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListener(pkOrPksOrListener,fieldNames,listener,?batch)
Params:
ParameterTypeDescription
*pkOrPksOrListener(Object|mapped)[]
*fieldNames"*"
*listenerMultiChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListenerList<T>(pks,fieldNames,listener)
Params:
ParameterTypeDescription
*pks(Object|mapped)[]
*fieldNamesT[]
*listenerMultiChangeListener
Returns:ChangeListenerUnsubscribe
addListenerList(pks,fieldNames,listener)
Params:
ParameterTypeDescription
*pks(Object|mapped)[]
*fieldNames"*"
*listenerMultiChangeListener
Returns:ChangeListenerUnsubscribe
batch<T>(run)
Params:
ParameterTypeDescription
*run
Returns:T
delete(pk,?fieldNames)
Params:
ParameterTypeDescription
*pkObject|mapped
fieldNames'*'|[string|string[]][]
Returns:boolean
get<T>(pk,fieldNames)
Params:
ParameterTypeDescription
*pkObject|mapped
*fieldNamesT[]
Returns:null|PartialViewModel
get(pk,fieldNames)
Params:
ParameterTypeDescription
*pkObject|mapped
*fieldNames"*"
Returns:null|PartialViewModel
get<T>(record)
Params:
ParameterTypeDescription
*recordPartialViewModel
Returns:null|PartialViewModel
getAll(fieldNames)
Params:
ParameterTypeDescription
*fieldNames"*"
getAll<T>(fieldNames)
Params:
ParameterTypeDescription
*fieldNamesT[]
getList<T,RemoveNullsT = true>(pks,fieldNames,?removeNulls)
Params:
ParameterTypeDescription
*pks(Object|mapped)[]
*fieldNamesT[]
removeNullsRemoveNullsT
getList<RemoveNullsT = true>(pks,fieldNames,?removeNulls)
Params:
ParameterTypeDescription
*pks(Object|mapped)[]
*fieldNames"*"
removeNullsRemoveNullsT
getList<T,RemoveNullsT = true>(records,?removeNulls)
Params:
ParameterTypeDescription
*recordsT[]
removeNullsRemoveNullsT
Returns:T[]|(null|T)[]
getList<T,RemoveNullsT = true>(records,?removeNulls)
Params:
ParameterTypeDescription
*recordsPartialViewModel[]
removeNullsRemoveNullsT

Properties

cache

Source
never

viewModel

Source
ViewModelClassType

Static Properties

listenerBatcher

Source
An object with these properties:
PropertyTypeDescription
*batch
*call
*callAll
isActiveboolean
pendingMap
pendingAllSet
pendingNoBatchMap