
export default {
  inserted: function (el, binding, vnode) {
    const callback = binding.value
    const observer = new ResizeObserver(entries => {
      entries.forEach(entry => {
        callback(entry.contentRect)
      })
    })
    observer.observe(el)
    el._observer = observer
  },
  unbind: (el) => {
    el._observer.disconnect()
    delete el._observer
  }

}
