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

package.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
import { curry } from "ramda";
export var handleMetaClick = 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);
});
export var 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