Carriage

Carriage

Universal basic carriage for funicular.

Constructor

new Carriage(funicular, name, data)

Source:
Parameters:
Name Type Description
funicular Funicular

Link to instance of Funicular, used as namespace of carriages for this carriage.

name String

Unique name of this carriage.

data

Any outer system data needed for mounting one carriage.

Methods

disable(callback)

You must override it with useful functionality. It method must forget, disable, stop and erase all that was added, enabled, runned and writed at Carriage.enable. It must call callback! Otherwise, the demounting chain may break.

Source:
Parameters:
Name Type Description
callback Carriage~disableCallback

enable(callback)

You must override it with useful functionality. Can gets and mount childs carriages into Carriage.childs. It method must added, enable, run and write all that was forgeted, disabled, stoped and erased at Carriage.disable. It must call callback! Otherwise, the demounting chain may break.

Source:
Parameters:
Name Type Description
callback Carriage~enableCallback

mount()

Based on data, mount this carriage. Use Carriage.enable for useful functionality. Calls all functions from Carriage.mountedCallbacks, if this carriage did unmount.

Source:

mountChild(name, data, callbackopt)

Mount carriage as child for this carriage.

Source:
Parameters:
Name Type Attributes Description
name String
data
callback Carriage~mountCallback <optional>

remount()

Remount this carriage.

Source:
To Do:
  • If Carriage.invalid is `true`, mount new carriage based on this name and data and unmount this carriage.

shouldRemount(unmountErroropt, oldCarriage, mountErroropt, newCarriageopt)

You can override it with useful functionality. Synchronously answers the question - is it necessary to remount this parent while remounting the child?

Source:
Parameters:
Name Type Attributes Description
unmountError <optional>
oldCarriage Carriage
mountError <optional>
newCarriage Carriage <optional>

tieChild(child)

Tie one child with this carriage parent.

Source:
Parameters:
Name Type Description
child Carriage

unique(stateopt) → {Boolean}

Get unique state. If sended argument state returns boolean.

Source:
Parameters:
Name Type Attributes Description
state Boolean <optional>

if sended, set this carriage as unique primary of this name.

Returns:
Type:
Boolean

unmount(callbackopt)

Sort unmount this carriage with childs. The carriages necessary for some other carriages will not be unmounted. Calls all functions from Carriage.unmountedCallbacks, if this carriage did unmount. Calls argument callback in any case, even if the unmount did not happen.

Source:
Parameters:
Name Type Attributes Description
callback Carriage~unmountCallback <optional>

unmountChilds()

Cicle for sort unmount childs of this carriage. Not asynchronously and with callback, because there is no sense in waiting for the end of the unmounting childs. If you do not agree please describe the reason in the issues.

Source:

untieChild(child)

Untie one child with this carriage parent.

Source:
Parameters:
Name Type Description
child Carriage