@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
20 lines • 626 B
JavaScript
const CUSTOM_EVENTS = {
FOCUS_OUTSIDE: "AKSEL_FOCUS_OUTSIDE",
POINTER_DOWN_OUTSIDE: "AKSEL_POINTER_DOWN_OUTSIDE",
POINTER_UP_OUTSIDE: "AKSEL_POINTER_UP_OUTSIDE",
};
function dispatchCustomEvent(name, handler, detail) {
if (!handler) {
return;
}
const target = detail.originalEvent.target;
const event = new CustomEvent(name, {
bubbles: false,
cancelable: true,
detail,
});
target.addEventListener(name, handler, { once: true });
target.dispatchEvent(event);
}
export { CUSTOM_EVENTS, dispatchCustomEvent };
//# sourceMappingURL=dispatchCustomEvent.js.map