/** Dispatch event on click outside of node */
export function clickOutside(node) {
	const handleClick = (event) => {
		if (event.target.getAttribute('data-id') === 'modal_backdrop') {
			node.dispatchEvent(new CustomEvent('click_outside', node));
		}
	};
	document.removeEventListener('click', handleClick, true);
	document.addEventListener('click', handleClick, true);
}
