UNPKG

fluid-dnd

Version:

An agnostic drag and drop library to sort all kind of lists. With current support for vue, react and svelte

20 lines (19 loc) 660 B
import { TEMP_CHILD_CLASS } from '.'; import { IsHTMLElement } from './typesCheckers'; export const observeMutation = (callback, element, options, mutationFilter = () => true) => { const observe = new MutationObserver((mutations) => { mutations = mutations.filter(mutationFilter); if (mutations.length > 0) { const mutation = mutations[0]; callback(observe, mutation); } }); observe.observe(element, options); return observe; }; export const isTempElement = (element) => { if (!IsHTMLElement(element)) { return false; } return element.classList.contains(TEMP_CHILD_CLASS); };