"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makeDragEndListener = makeDragEndListener;
exports.listenDragEnd = listenDragEnd;
const pointer_1 = require("../pointer");
function makeDragEndListener(listener, _global = false) {
    return (component) => {
        return listenDragEnd(component, listener, _global);
    };
}
function listenDragEnd(component, listener, _global = false) {
    const { $element } = component;
    const dragStartListener = (_event) => {
        const { $context } = component;
        const event = (0, pointer_1.applyContextTransformToPointerEvent)($context, _event);
        listener(event);
    };
    $element.addEventListener('dragend', dragStartListener, _global);
    return () => {
        $element.removeEventListener('dragend', dragStartListener, _global);
    };
}
//# sourceMappingURL=dragend.js.map