undox
Version:
Redux implementation of Undo/Redo based on storing actions instead of states.
33 lines (32 loc) • 805 B
JavaScript
;
exports.__esModule = true;
exports.group = exports.undo = exports.redo = exports.UndoxTypes = void 0;
var UndoxTypes;
(function (UndoxTypes) {
UndoxTypes["UNDO"] = "undox/UNDO";
UndoxTypes["REDO"] = "undox/REDO";
UndoxTypes["GROUP"] = "undox/GROUP";
})(UndoxTypes = exports.UndoxTypes || (exports.UndoxTypes = {}));
/*
* Action Creators
*/
exports.redo = function (nStates) {
if (nStates === void 0) { nStates = 1; }
return {
type: UndoxTypes.REDO,
payload: nStates
};
};
exports.undo = function (nStates) {
if (nStates === void 0) { nStates = 1; }
return {
type: UndoxTypes.UNDO,
payload: nStates
};
};
exports.group = function (actions) {
return {
type: UndoxTypes.GROUP,
payload: actions
};
};