import eruda from 'eruda'
let isCreated = false
export function switchDebugger(){
    if(!isCreated){
        createDebugger()
    } else {
        hideDebugger()
        destroyDebugger()
    }
}
export function showDebugger(){
    if(!isCreated){
        return
    }

    eruda.show()
}

export function hideDebugger(){
    if(!isCreated){
        return
    }

    eruda.hide()
}

export function createDebugger(){
    if(!isCreated){
        isCreated = true
        eruda.init({
            useShadowDom: true,
            autoScale: true,

            defaults: {
                displaySize: 50,
                transparency: 1,
                theme: 'Atom One Light'
            }
        })
    } else {
        eruda.show()
    }
}

export function destroyDebugger(){
    if(!isCreated){
        return
    }

    eruda.destroy()
    isCreated = false
}
