handsontable
Version:
Handsontable is a JavaScript Spreadsheet Component available for React, Angular and Vue.
50 lines (42 loc) • 1.18 kB
JavaScript
;
exports.__esModule = true;
exports.isImmediatePropagationStopped = isImmediatePropagationStopped;
exports.isLeftClick = isLeftClick;
exports.isRightClick = isRightClick;
exports.stopImmediatePropagation = stopImmediatePropagation;
/**
* Prevent other listeners of the same event from being called.
*
* @param {Event} event The mouse event object.
*/
function stopImmediatePropagation(event) {
event.isImmediatePropagationEnabled = false;
event.cancelBubble = true;
}
/**
* Check if event was stopped by `stopImmediatePropagation`.
*
* @param {Event} event The mouse event object.
* @returns {boolean}
*/
function isImmediatePropagationStopped(event) {
return event.isImmediatePropagationEnabled === false;
}
/**
* Check if provided event was triggered by clicking the right mouse button.
*
* @param {Event} event The mouse event object.
* @returns {boolean}
*/
function isRightClick(event) {
return event.button === 2;
}
/**
* Check if provided event was triggered by clicking the left mouse button.
*
* @param {Event} event The mouse event object.
* @returns {boolean}
*/
function isLeftClick(event) {
return event.button === 0;
}