Timeline

Timeline

DALS.Timeline: Represents a singular timeline in an undo/redo tree within the Delta Action Logging System (DALS). .value is structured as an Array<Object>, with [0] representing the head state, and subsequent elements state mutations.

Note that actions should generally be pushed to a timeline using the corresponding addAction(arg0_json:Object|string) function. DALS.undo()/DALS.redo() should generally be called instead of specific jumpTo() instructions within a timeline.

Constructor:
  • arg0_options: Object
    • .name: string
    • .parent_timeline: Array<string, number> - [0] represents the DALS.Timeline .id belonging to the parent timeline, and [1] the index of the parent branch node.
Instance:
  • .id=Class.generateRandomID(DALS.Timeline): string
  • .initial_timeline: boolean
  • .name="Timeline " + this.id: string
  • .parent_timeline: Array<string, number>
  • .value: Array<string> - Array of JSON strings. [0] represents the state head, [n] represents state mutations.
Methods:
  • addAction(arg0_json:Object|string, arg1_options:{ do_not_parse_action:boolean }) | DALS.Action - Pushes an action to the timeline, and attempts to parse it automatically.
  • branch(arg0_options:Object) | DALS.Timeline - arg0_options is the same as the options asked for DALS.Timeline.
  • delete() - Deletes and removes the present timeline.
  • jumpToAction(arg0_action_id:number|string)
  • jumpToEnd()
  • jumpToStart()
  • removeAction(arg0_action_id:number|string) - arg0_action_id is either the index of the action, or its .id.
Static Fields:
  • .current_index: number - The index of the current timeline the state is at.
  • .current_timeline: string - The ID of the current timeline being displayed.
  • .instances: Array<DALS.Timeline>
Static Methods:
  • getTimeline(arg0_timeline_id:string) | DALS.Timeline - Returns a DALS.Timeline object given a timeline ID.
  • load(arg0_file_path:string) - Loads a new head state from a given file.
  • jumpToTimeline(arg0_timeline_id:string) - Jumps to the head state of a specific timeline.
  • save(arg0_file_path:string) - Saves the present state to a given file.

Constructor

new Timeline()

Source:

Members

current_index :number

Source:
Type:
  • number

current_timeline :string

Source:
Type:
  • string

instances :Array.<DALS.Timeline>

Source:
Type:

Methods

addAction(arg0_json, arg1_optionsopt) → {DALS.Action}

Adds a given action to the current timeline and immediately parses it by default.

Source:
Parameters:
Name Type Attributes Description
arg0_json Object | string
arg1_options Object <optional>
Name Type Attributes Default Description
di_not_parse_action boolean <optional>
false
Returns:
Type:
DALS.Action

branch(arg0_options) → {DALS.Timeline}

Branches off a new timeline from the current timeline. If the current timeline is not selected, the branch node is automatically placed at the end of the timeline.

Source:
Parameters:
Name Type Description
arg0_options Object

Refer to DALS.Timeline.options for information on what options are acceptable.

Returns:
Type:
DALS.Timeline

delete()

Deletes the present timeline and removes its references.

Source:

jumpToAction(arg0_action_id)

Jumps to a specific action ID in the timeline, starting from its head, utilising .parseAction()

Source:
Parameters:
Name Type Description
arg0_action_id number | string

jumpToEnd()

Jumps to the end of this timeline.

Source:

jumpToStart()

Jumps to the start of this timeline.

Source:

removeAction(arg0_action_id)

Removes an action from the timeline based upon its ID.

Source:
Parameters:
Name Type Description
arg0_action_id string

(static) getTimeline(arg0_timeline_id) → {DALS.Timeline}

Returns a DALS.Timeline object based upon a timeline ID string.

Source:
Parameters:
Name Type Description
arg0_timeline_id Object | string
Returns:
Type:
DALS.Timeline

(static) jumpToTimeline(arg0_timeline_id)

Jumps to the start of a timeline based off its ID.

Source:
Parameters:
Name Type Description
arg0_timeline_id DALS.Timeline | string

(static) load(arg0_file_path)

Loads in a new state based upon the JSON data contained at a file path.

Source:
Parameters:
Name Type Description
arg0_file_path string

(static) save(arg0_file_path)

Saves the present state as JSON to a new file path.

Source:
Parameters:
Name Type Description
arg0_file_path string