package.cjs.react-utils.metaClick.metaClick.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isMetaKeyPressed = exports.handleMetaClick = void 0;
var _ramda = require("ramda");
var handleMetaClick = (0, _ramda.curry)(function (history, params, event) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
if (isMetaKeyPressed(event)) {
return window.open(params.pathname || params, "_blank");
}
var _options$isHistoryRep = options.isHistoryReplace,
isHistoryReplace = _options$isHistoryRep === void 0 ? false : _options$isHistoryRep;
var historyMethod = isHistoryReplace ? history.replace : history.push;
return historyMethod(params);
});
exports.handleMetaClick = handleMetaClick;
var isMetaKeyPressed = function isMetaKeyPressed(event) {
return !!(event !== null && event !== void 0 && event.ctrlKey || event !== null && event !== void 0 && event.metaKey);
};
exports.isMetaKeyPressed = isMetaKeyPressed;
//# sourceMappingURL=metaClick.js.map