@joergmittaglawo/dmvconfig
Version:
DMV Configuration scripts for Lawo V__matrix Distributed Multiviewers.
1 lines • 659 B
JavaScript
export function download(t){return new Promise((o,e)=>{let n=new XMLHttpRequest;n.timeout=t.timeout_ms,n.onreadystatechange=()=>{4===n.readyState&&(200===n.status?o(n.responseText):e(`Unable to download ${t.protocol}://${t.ip}:${t.port}/${t.path} (Status ${n.status.toString()})}`))},n.onerror=()=>{e(`Unable to download ${t.protocol}://${t.ip}:${t.port}/${t.path} (Status ${n.status.toString()})}`)},n.ontimeout=()=>{e(`Unable to download ${t.protocol}://${t.ip}:${t.port}/${t.path} (request timed out)}`)},n.open("GET",`${t.protocol}://${t.ip}:${t.port}/${t.path}`),n.send(null)})}export async function download_json(t){return JSON.parse(await download(t))}