import Vue from 'vue'
import ActionSheet from './actionsheet'

import elementUtil from '../../common/scripts/elementUtil'

class VueActionSheet {
  constructor () {
    this._vm = undefined
  }
  show (option) {
    elementUtil.createElement('vum-action-sheet')

    this._vm = new Vue(ActionSheet)
    this._vm.$mount('[vum-action-sheet]')

    setTimeout(() => {
      this._vm.show(option)
    })
  }

  hide (buttonIndex) {
    this._vm.hide(buttonIndex)
  }

  getState () {
    return this._vm ? this._vm.getState() : 0
  }
}

export default new VueActionSheet()
