DALS (Delta Actions Logging System), also known as Undo/Redo or Undo/Redo Trees is a comprehensive system for logging delta changes to a given state, typically global.main and automatically producing timelines and UIs that can be used for rich in-session version control.
 
As per convention, internal helper functions are located towards the bottom of their respective relevant sections. If you wish to use a conventional Undo/Redo stack instead of branching timelines, you can restrict Undo/Redo systems to a single default timeline with overwrite permissions. Examples are located at the bottom of the page on how they can be used. All timeline data is placed in global.actions and global.timelines.
 
global.actions: (Object)
  - current_index: (Number)
 
  - current_timeline: (String)
 
  - initial_timeline: (String)
 
  - <action_key>: (Object, ActionDefine)
 
 
global.timelines: (Object)
  - <timeline_id>: (Array<Object, Action>)
 
 
createAction() - Sets the action performed in the current Timeline.
  - arg0_action_key: (String) - The key to assign to the action in question.
 
  - arg1_options: (Object)
      - name: (String) - The human-readable name for the action.
  
      - function: (String) - The function key which performs the action.
 
      - reverse_function: (String) - The function key which reverses the action.
 
    
   
  - Returns: (Object, Action)
 
 
deleteAction() - Deletes an action from the action config.
  - arg0_action_key: (String) - The key of the action to delete.
 
  - Returns: (Object, Action)
 
 
resetUndoRedo() - Resets the Undo/Redo system.
 
¶ Undo/Redo Initialisation and Timelines
 
createTimeline() - Creates a new timeline from a parent (or an unassociated one if no parent is defined). The parent may be cloned into the new timeline if necessary.
  - arg0_parent_timeline: (String) - Optional. The ID of the parent timeline to split off from. global.actions.initial_timeline by default.
 
  - arg1_options: (Object)
      - timeline_index: (Number) - Optional. The index off of which the timeline should split. The last index of the timeline by default
 
      - return_key: (Boolean) - Optional. Whether to return the timeline key. False by default.
 
    
   
 
deleteTimeline() - Deletes a timeline and the child timelines that branch off of it.
  - arg0_timeline_id: (String) - The timeline ID to delete.
 
 
generateTimelineGraph() - Generates a graph Object of all timelines starting from initial_timeline[0].
  - arg0_timeline_id: (String) - The ID of the timeline to start generating a graph from.
 
  - arg1_options: (Object)
      - x_offset: (Number) - Optional. The current x offset. 0 by default.
 
      - y_offset: (Number) - Optional. The current y offset. 0 by default.
  
      - excluded_timelines: (Array<String>) - Optional. Optimisation parameter.
 
      - is_recursive: (Array<String>) - Optional. Whether this is a recursive call. Optimisation parameter.
 
    
   
  - Returns: (Object) - A timeline graph object to render.
 
 
getFlippedTimeline() - Flips a timeline's .x/.y coordinates.
  - arg0_graph: (Object) - The graph of the timeline to pass to the function.
 
  - Returns: (Object)
 
 
getTimelineMaxX() - Fetches the maximum .x value in a timeline graph.
  - arg0_graph: (Object) - The timeline graph to insert.
 
  - Returns: (Number)
 
 
getTimelineMaxY() - Fetches the maximum .y value in a timeline graph.
  - arg0_graph: (Object) - The timeline graph to insert.
 
  - Returns: (Number)
 
 
getTimelineWidth() - Fetches the total X/Y width of a timeline from all future descendant timelines.
  - arg0_timeline_id: (String) - The ID of the timeline to measure the descendant width of.
 
  - Returns: (Number)
 
 
initialiseUndoRedo() - Initialises action config/caching if necessary.
 
 
getCurrentAction() - Fetches the last action loaded in the current timeline.
  - Returns: (Object, Action)
 
 
loadTimeline() - Loads in the current timeline, undoing/redoing all actions needed to get there.
  - arg0_timeline_id: (String) - The ID of the timeline to load into the current state.
 
  - arg1_options: (Object)
      - timeline_index: (Number) - Optional. The index off of which the timeline should split. The last index of the timeline by default.
 
    
   
 
jumpToTimeline() - Jumps to a specific timeline.
  - arg0_timeline_id: (String) - The timeline ID to jump to.
 
 
performAction() - Logs a delta action in the current timeline.
  - arg0_options: (Object)
      - action_id: (String) - The ID of the action currently being performed.
 
      - redo_function: (String) - The corresponding redo function.
 
      - redo_function_parameters: (Array<Variable, ...>) - The current arguments passed to perform the delta action.
 
      - undo_function: (String) - The corresponding undo function.
 
      - undo_function_parameters: (Array<Variable, ...>) - The arguments needed to undo the delta action.
 
    
   
 
redoAction() - Redoes an action in the current timeline.
  - Returns: (Boolean) - Whether the action was successfully redone.
 
 
undoAction() - Undoes an action in the current timeline.
  - Returns: (Boolean) - Whether the action was successfully undone.
 
 
 
Pathfinding functions from elsewhere in UF are used in navigating BrowserUI DALS Undo/Redo Trees, including A* algorithm implementations in particular. For more information, see BrowserUI - Pathfinding.
 
constructTimelineGraph() - Returns an A* compatible graph of global.timelines.
  - Returns: (Object)
      - <Timeline ID-index>: (Object)
          - <Timeline ID-index>: (Number) - Represents the connection cost between the current Timeline Position and another Timeline Position.