Skip to content

HistoryApi

Let's you add records to the undo history.

Description

The HistoryApi makes it possible to add undo/redo records which seemlessly integrate with DungeonDrafts built in History. A record is represented by any Object that has undo() and redo() methods.

Methods

void record ( Object history_record )
bool redo ( )
bool undo ( )

Signals

recorded ( history_record ):
Emitted when a new record is added to the history.

dropped ( history_record, type ):
Emitted when a record is dropped from the history, either due to exceeding the length of the history or due to being in the redo history when a new Record is recorded.

undo_begin ( history_record ):
Emitted before a records undo method is called.

undo_end ( history_record ):
Emitted before a records undo method has finished processing.

redo_begin ( history_record ):
Emitted before a records redo method is called.

redo_end ( history_record ):
Emitted before a records redo method has finished processing.

Enumerations

enum HistoryType:

  • UNDO = 0
  • REDO = 1
Denotes the type of history a record is currently recorded in.

Method Descriptions

void record ( Object history_record ):
Adds history_record to the history.

bool undo ( ):
Calls undo() on the next relevant record of the history.

bool redo ( ):
Calls redo() on the next relevant record of the history.