ViewModelCache

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

API

Constructor

new ViewModelCache(viewModel)

Arguments:

ArgumentTypeDescription
*viewModelViewModelClassType

Methods

add<T>(recordOrData)

Arguments:

ArgumentTypeDescription
*recordOrDataT
Returns:T
add<T>(recordOrData)

Arguments:

ArgumentTypeDescription
*recordOrDataT[]
Returns:T[]
add<FieldNames>(recordOrData)

Arguments:

ArgumentTypeDescription
*recordOrDatamapped
add<FieldNames>(recordOrData)

Arguments:

ArgumentTypeDescription
*recordOrDatamapped[]
addList<T>(recordsOrData)

Arguments:

ArgumentTypeDescription
*recordsOrDataT[]
Returns:T[]
addList<FieldNames>(recordsOrData)

Arguments:

ArgumentTypeDescription
*recordsOrDatamapped[]
addListener(listener)

Arguments:

ArgumentTypeDescription
*listenerAllChangesListener
Returns:ChangeListenerUnsubscribe
addListener<T>(pkOrPks,fieldNames,listener,?batch)

Arguments:

ArgumentTypeDescription
*pkOrPksObject|mapped
*fieldNamesT[]
*listenerChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListener(pkOrPks,fieldNames,listener,?batch)

Arguments:

ArgumentTypeDescription
*pkOrPksObject|mapped
*fieldNames"*"
*listenerChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListener<T>(pkOrPks,fieldNames,listener,?batch)

Arguments:

ArgumentTypeDescription
*pkOrPks(Object|mapped)[]
*fieldNamesT[]
*listenerMultiChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListener(pkOrPksOrListener,fieldNames,listener,?batch)

Arguments:

ArgumentTypeDescription
*pkOrPksOrListener(Object|mapped)[]
*fieldNames"*"
*listenerMultiChangeListener
batchboolean
Returns:ChangeListenerUnsubscribe
addListenerList<T>(pks,fieldNames,listener)

Arguments:

ArgumentTypeDescription
*pks(Object|mapped)[]
*fieldNamesT[]
*listenerMultiChangeListener
Returns:ChangeListenerUnsubscribe
addListenerList(pks,fieldNames,listener)

Arguments:

ArgumentTypeDescription
*pks(Object|mapped)[]
*fieldNames"*"
*listenerMultiChangeListener
Returns:ChangeListenerUnsubscribe
batch<T>(run)

Arguments:

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

Arguments:

ArgumentTypeDescription
*pkObject|mapped
fieldNames'*'|[string|string[]][]
Returns:boolean
get<T>(pk,fieldNames)

Arguments:

ArgumentTypeDescription
*pkObject|mapped
*fieldNamesT[]
Returns:null|PartialViewModel
get(pk,fieldNames)

Arguments:

ArgumentTypeDescription
*pkObject|mapped
*fieldNames"*"
Returns:null|PartialViewModel
get<T>(record)

Arguments:

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

Arguments:

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

Arguments:

ArgumentTypeDescription
*fieldNamesT[]
getList<T,RemoveNullsT = true>(pks,fieldNames,?removeNulls)

Arguments:

ArgumentTypeDescription
*pks(Object|mapped)[]
*fieldNamesT[]
removeNullsRemoveNullsT
getList<RemoveNullsT = true>(pks,fieldNames,?removeNulls)

Arguments:

ArgumentTypeDescription
*pks(Object|mapped)[]
*fieldNames"*"
removeNullsRemoveNullsT
getList<T,RemoveNullsT = true>(records,?removeNulls)

Arguments:

ArgumentTypeDescription
*recordsT[]
removeNullsRemoveNullsT
Returns:T[]|(null|T)[]
getList<T,RemoveNullsT = true>(records,?removeNulls)

Arguments:

ArgumentTypeDescription
*recordsPartialViewModel[]
removeNullsRemoveNullsT

Properties

cache

Source
never

viewModel

Source
ViewModelClassType

Static Properties

listenerBatcher

Source
An object with these properties:
PropertyTypeDescription
*batch
*call
*callAll
isActiveboolean
pending
pendingAllSet
pendingNoBatch