@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
24 lines • 778 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CUSTOM_EVENTS = void 0;
exports.dispatchCustomEvent = dispatchCustomEvent;
const CUSTOM_EVENTS = {
FOCUS_OUTSIDE: "AKSEL_FOCUS_OUTSIDE",
POINTER_DOWN_OUTSIDE: "AKSEL_POINTER_DOWN_OUTSIDE",
POINTER_UP_OUTSIDE: "AKSEL_POINTER_UP_OUTSIDE",
};
exports.CUSTOM_EVENTS = CUSTOM_EVENTS;
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);
}
//# sourceMappingURL=dispatchCustomEvent.js.map