import Vue from 'vue'
import UIViewLoading from './ViewLoading'
import UIWaiting from './Waiting'
import UISmallWaiting from './smallWaiting'



export const ViewLoading = Vue.extend(UIViewLoading)
export const Waiting = Vue.extend(UIWaiting)
export const SmallWaiting = Vue.extend(UISmallWaiting)


const waiting = function(){
    let instance = new Waiting().$mount()
    document.body.appendChild(instance.$el)
    return instance
}

const smallWaiting = function(){
    let instance = new SmallWaiting().$mount()
    document.body.appendChild(instance.$el)
    return instance
}


export function $viewLoading(data={}){
    let instance = new ViewLoading({data}).$mount()
    document.body.appendChild(instance.$el)
    return instance
}

// export function $Waiting(data={}){
//     let instance = new ViewLoading({data}).$mount()
//     document.body.appendChild(instance.$el)

//     return instance
// }

// export const $waiting = (function(){
//     let instance = new ViewLoading({data}).$mount()
//     document.body.appendChild(instance.$el)
// }())



export const $waiting = waiting()
export const $smallWaiting = smallWaiting()


