UNPKG

@devexperts/dxcharts-lite

Version:
33 lines (32 loc) 925 B
/* * Copyright (C) 2019 - 2025 Devexperts Solutions IE Limited * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. * If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. */ export const MouseButton = { left: 0, middle: 1, right: 2, }; /** * @param {Element} element * @param {function} listener * @param {string} eventType * @param {boolean?} useCapture * @return {Function} */ export function subscribeListener(element, listener, eventType, useCapture) { // @ts-ignore element.addEventListener(eventType, listener, useCapture); return function () { // @ts-ignore element.removeEventListener(eventType, listener, useCapture); }; } export function leftMouseButtonListener(cb) { return (e) => { if (e.button === MouseButton.left) { cb(e); } }; }