handsontable
Version:
Handsontable is a JavaScript Spreadsheet Component available for React, Angular and Vue.
39 lines (36 loc) • 960 B
JavaScript
/**
* Prevent other listeners of the same event from being called.
*
* @param {Event} event The mouse event object.
*/
export 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}
*/
export 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}
*/
export 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}
*/
export function isLeftClick(event) {
return event.button === 0;
}