Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
Cómo cargar activos en un html de manera más eficiente

He estado trabajando en un juego basado en html que está escrito en javascript. Me he estado preguntando cómo podría cargar los activos desde un archivo zip dentro del html sin tenerlo en 1 sola línea de código (que se muestra en la imagen que cargué después ("script type="p4-project">19935291") La razón por la que quiero que sea más eficiente es porque tenerlo en 1 línea de código parece hacer que se cargue muy lento.

(la imagen muestra más del código que está desordenado con la pila)

 </script> <script></script> <script type="p4-project">19935291,//this code just lists the assets <script> const getProjectData = (function() { const storage = scaffolding.storage; storage.onprogress = (total, loaded) => { setProgress(interpolate(0.75, 0.98, loaded / total)); }; storage.addHelper({ load: (assetType, assetId, dataFormat) => zip.file(assetId + '.' + dataFormat) .async('uint8array') .then((data) => new storage.Asset(assetType, assetId, dataFormat, data)) }); return () => (async () => { const base85decode = e=>{const t=e=>(40===e&&(e=60),41===e&&(e=62),e-42),n=e.indexOf(","),c=+e.substring(0,n),o=new ArrayBuffer((s=c)%4==0?s:s+(4-s%4));var s;const a=new Uint32Array(o);for(let c=n+1,o=0;c<e.length;c+=5,o++)a[o]=85*t(e.charCodeAt(c+4))*85*85*85+85*t(e.charCodeAt(c+3))*85*85+85*t(e.charCodeAt(c+2))*85+85*t(e.charCodeAt(c+1))+t(e.charCodeAt(c));return new Uint8Array(o,0,c)}; const dataElements = Array.from(document.querySelectorAll('script[type="p4-project"]')); const result = base85decode(dataElements.map(i => i.textContent).join('')); dataElements.forEach(i => i.remove()); return result; })().then(async (data) => { zip = await Scaffolding.JSZip.loadAsync(data); return zip.file('project.json').async('arraybuffer'); }); })(); </script> <script> const run = async () => { const projectData = await getProjectData(); await scaffolding.loadProject(projectData); setProgress(1); loadingScreen.hidden = true; if (true) { scaffolding.start(); } else { launchScreen.hidden = true; launchScreen.addEventListener('click', () => { launchScreen.hidden = false; scaffolding.start(); }); launchScreen.focus(); } }; run().catch(handleError); </script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!