export async function begin(){
    // const result = await window.electronAPI.runNodejsScript('adb-connect', '192.168.2.5', '5555')
    // alert(result.stdout) // 脚本输出
    // const result = await window.electronAPI.runPythonScript('test', '1')
    // alert(result.stdout) // 脚本输出


    const is_exist = await window.electronAPI.runNodejsScript('json-parser', 'read', 'jason/testjson')
    if (is_exist.success) {
        alert('File exists')
    } else {
        alert('File does not exist')
    }
}

export async function handleRefresh(e, self) {
    // Start loading animation
    self.startAnimation()

    // Simulate async operation
    setTimeout(() => {
        // Stop loading animation when done
        self.stopAnimation()
    }, 5000) 
}

export async function handleAdd() {
    console.log('Add device clicked')

    const ip = document.querySelector('.ip-input input').value
    const result = await window.electronAPI.runNodejsScript('adb-connect', ip, '5555')
    alert(result.stdout) // 脚本输出

}