echo-helper.js (601B)
1 function get_resource_echo_url(uid, url) { 2 return `/css/fetching/support/echo-headers.py?token=${uid}&location=${url}` 3 } 4 5 function wait_for_resource(url) { 6 return new Promise(resolve => { 7 const po = new PerformanceObserver(list => { 8 const entries = list.getEntries(); 9 if (entries.find(e => e.name.includes(url))) 10 resolve(); 11 }) 12 po.observe({type: "resource", buffered: true}); 13 }); 14 } 15 16 async function get_headers(uid) { 17 return await (await fetch(`/css/fetching/support/echo-headers.py?token=${uid}&location=echo`)).json() 18 }