all files / src/ utils.ts

88.89% Statements 8/9
100% Branches 2/2
50% Functions 1/2
88.89% Lines 8/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23      12× 12× 12× 12× 12× 12×                        
import DialogXComponent from './dialog.vue'

export interface VueDialogXComponent {
  commit: Function
  $mount: Function,
  $off: Function
  $destroy: Function
  $el: HTMLDivElement
  $on: Function
}
 
export const disableTouchmove = (e: Event): void => {
  e.preventDefault()
}
 
export const createVm = (Vue: any): VueDialogXComponent => {
  const DialogConstructor: any = Vue.extend(DialogXComponent)
  const node: HTMLDivElement = document.createElement('div')
  const bodyDom: HTMLBodyElement | null = document.querySelector('body')
  bodyDom && bodyDom.appendChild(node)
  const _vm: VueDialogXComponent = new DialogConstructor()
  return _vm.$mount(node)
}