core-graphics
Version:
A core library for creating shape-based graphic editors
35 lines (34 loc) • 1.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPushHistoryEventAction = isPushHistoryEventAction;
exports.isUpdateHistoryEventAction = isUpdateHistoryEventAction;
exports.isDeleteHistoryEventAction = isDeleteHistoryEventAction;
exports.pushHistoryEventAction = pushHistoryEventAction;
exports.updateHistoryEventAction = updateHistoryEventAction;
exports.deleteHistoryEventAction = deleteHistoryEventAction;
var EditorActionType = exports.EditorActionType = undefined;
(function (EditorActionType) {
EditorActionType[EditorActionType["PushHistoryEvent"] = 0] = "PushHistoryEvent";
EditorActionType[EditorActionType["UpdateHistoryEvent"] = 1] = "UpdateHistoryEvent";
EditorActionType[EditorActionType["DeleteHistoryEvent"] = 2] = "DeleteHistoryEvent";
})(EditorActionType || (exports.EditorActionType = EditorActionType = {}));
function isPushHistoryEventAction(base) {
return base && base.type === EditorActionType.PushHistoryEvent;
}
function isUpdateHistoryEventAction(base) {
return base && base.type === EditorActionType.UpdateHistoryEvent;
}
function isDeleteHistoryEventAction(base) {
return base && base.type === EditorActionType.DeleteHistoryEvent;
}
function pushHistoryEventAction(ev) {
return { type: EditorActionType.PushHistoryEvent, payload: { ev: ev } };
}
function updateHistoryEventAction(id, ev) {
return { type: EditorActionType.UpdateHistoryEvent, payload: { id: id, ev: ev } };
}
function deleteHistoryEventAction(id) {
return { type: EditorActionType.DeleteHistoryEvent, payload: { id: id } };
}