export function initDraggables()

in src/components/draggable.js [11:34]


export function initDraggables() {
  if (draggables) {
    removeDraggables(draggables)
  }

  const attr = 'data-draggable'

  draggables = []
  for (const el of document.querySelectorAll(`[${attr}]`)) {
    const index = draggables.findIndex(d => d.source === el)
    if (index > -1) {
      // console.warn('[draggable] already registered:', el, '@', index)
      continue
    } else {
      // console.warn('[draggable] add:', el)
    }
    draggables.push(new Draggable(el))
  }

  if (draggables.length) {
    window.addEventListener('resize', resizeAll)
    global.DRAGGABLES = draggables
  }
}