@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
17 lines • 869 B
JavaScript
;
/* https://github.com/radix-ui/primitives/blob/main/packages/core/primitive/src/primitive.tsx#L1 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.composeEventHandlers = composeEventHandlers;
/**
* Utility to consistently call original eventhandler, often from props and internal eventhandler
* @internal
*/
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
return function handleEvent(event) {
originalEventHandler === null || originalEventHandler === void 0 ? void 0 : originalEventHandler(event);
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
}
};
}
//# sourceMappingURL=composeEventHandlers.js.map