API Docs for:
Show:

BaseList Class

Extends BaseModel
Module: base-domain

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

(
  • itemModelName
)
Function

creates child class of BaseList

Parameters:

  • itemModelName String

Returns:

Function:

child class of BaseList

getFacade

() Facade

Inherited from Base: src/lib/base.coffee:32

get facade

the implementation is in Facade#requre()

Returns:

getPropInfo

() PropInfo public

get an instance of PropInfo, which summarizes properties of this class

Returns:

include

(
  • [options]
)
Promise(BaseModel)

include all relational models if not set

Parameters:

  • [options] Object optional
    • [recursive] Boolean optional

      recursively include models or not

Returns:

Promise(BaseModel):

self

inherit

(
  • anotherModel
)
BaseModel

inherit value of anotherModel

Parameters:

Returns:

BaseModel:

this

last

() public

last item

on

() public

on addEventListeners for 'loaded'

setEntityProp

(
  • prop
  • submodel
)
BaseModel

set related model(s)

Parameters:

  • prop String

    property name of the related model

  • submodel Entity | Array

Returns:

BaseModel:

this

setIds

(
  • ids
)

set ids.

Parameters:

  • ids Array(String | Number)

setItems

(
  • models
)

set items

Parameters:

  • models Array

sort

() protected

sort items in constructor

toArray

() public

export models to Array

toPlainObject

() Object

Inherited from BaseModel but overwritten in src/lib/base-list.coffee:199

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

unsetEntityProp

(
  • prop
)
BaseModel

unset related model(s)

Parameters:

  • prop String

    property name of the related models

Returns:

BaseModel:

this

Properties

ids

Array public

ids: get ids of items

itemFactory

BaseFactory

itemFactory: instance of factory which creates item models

itemModelName

String protected static

model name of the item

items

Array

items: array of models

loaded

Boolean

loaded: is data loaded or not