UNPKG

@gorpacrate/core-graphics

Version:

A core library for creating shape-based graphic editors

34 lines 995 B
"use strict"; exports.__esModule = true; function getUndoEvent(history, author) { if (history.length === 0) { return undefined; } for (var i = (history.length - 1); i >= 0; i--) { var ev = history[i]; if ((ev.author === author) && (ev.applied === true)) { return ev; } } return undefined; } exports.getUndoEvent = getUndoEvent; function getRedoEvent(history, author) { if (history.length === 0) { return undefined; } var lastUnappliedAuthorEvent; for (var i = (history.length - 1); i >= 0; i--) { var ev = history[i]; if ((ev.author === author) && (ev.applied === false)) { lastUnappliedAuthorEvent = ev; continue; } if ((ev.author === author) && (ev.applied === true)) { return lastUnappliedAuthorEvent; } } return lastUnappliedAuthorEvent; } exports.getRedoEvent = getRedoEvent; //# sourceMappingURL=event-sourcing.js.map