All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.cjs.react-utils.metaClick.metaClick.js Maven / Gradle / Ivy

Go to download

A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.

There is a newer version: 4.12.3
Show newest version
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isMetaKeyPressed = exports.handleMetaClick = void 0;
var _ramda = require("ramda");
var handleMetaClick = exports.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);
});
var isMetaKeyPressed = exports.isMetaKeyPressed = function isMetaKeyPressed(event) {
  return !!(event !== null && event !== void 0 && event.ctrlKey || event !== null && event !== void 0 && event.metaKey);
};
//# sourceMappingURL=metaClick.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy