BaseList Class
list class of DDD pattern.
Methods
containsEntity
()
Boolean
public
static
returns item is Entity
Returns:
Boolean:
emitLoaded
()
private
tell listeners emit loaded
first
()
public
first item
getAnonymousClass
(
Function
-
itemModelName
creates child class of BaseList
Parameters:
-
itemModelNameString
Returns:
Function:
child class of BaseList
getPropInfo
()
PropInfo
public
get an instance of PropInfo, which summarizes properties of this class
Returns:
include
(
Promise(BaseModel)
-
[options]
include all relational models if not set
Parameters:
-
[options]Object optional-
[recursive]Boolean optionalrecursively include models or not
-
Returns:
Promise(BaseModel):
self
inherit
(
BaseModel
-
anotherModel
inherit value of anotherModel
Parameters:
-
anotherModelBaseModel
Returns:
BaseModel:
this
last
()
public
last item
on
()
public
on addEventListeners for 'loaded'
setEntityProp
(
BaseModel
-
prop -
submodel
set related model(s)
Parameters:
-
propStringproperty name of the related model
-
submodelEntity | Array
Returns:
BaseModel:
this
setIds
(
-
ids
set ids.
Parameters:
-
idsArray(String | Number)
setItems
(
-
models
set items
Parameters:
-
modelsArray
sort
()
protected
sort items in constructor
toArray
()
public
export models to Array
toPlainObject
()
Object
create plain list. if this list contains entities, returns their ids if this list contains non-entity models, returns their plain objects
Returns:
Object:
plainObject
Properties
ids
Array
public
ids: get ids of items
itemModelName
String
protected
static
model name of the item
items
Array
items: array of models
loaded
Boolean
loaded: is data loaded or not
