parse-xtc.ts 792 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import { parseXtc } from '../../mol-io/reader/xtc/parser';
  7. import './index.html';
  8. const parent = document.getElementById('app')!;
  9. const btn = document.createElement('button');
  10. btn.innerText = 'run';
  11. btn.onclick = run;
  12. parent.appendChild(btn);
  13. async function run() {
  14. const req = await fetch('test.xtc');
  15. const data = await req.arrayBuffer();
  16. console.log(data.byteLength);
  17. console.time('parse');
  18. const ret = await parseXtc(new Uint8Array(data)).run(o => {
  19. console.log(o.root.progress.current, o.root.progress.max);
  20. }, 1000);
  21. console.timeEnd('parse');
  22. console.log(ret);
  23. btn.innerText = 'done';
  24. }