UNPKG

molstar

Version:

A comprehensive macromolecular library.

42 lines 1.63 kB
"use strict"; /** * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> */ Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var parser_1 = require("../../mol-io/reader/xtc/parser"); require("./index.html"); var parent = document.getElementById('app'); var btn = document.createElement('button'); btn.innerText = 'run'; btn.onclick = run; parent.appendChild(btn); function run() { return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { var req, data, ret; return (0, tslib_1.__generator)(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, fetch('test.xtc')]; case 1: req = _a.sent(); return [4 /*yield*/, req.arrayBuffer()]; case 2: data = _a.sent(); console.log(data.byteLength); console.time('parse'); return [4 /*yield*/, (0, parser_1.parseXtc)(new Uint8Array(data)).run(function (o) { console.log(o.root.progress.current, o.root.progress.max); }, 1000)]; case 3: ret = _a.sent(); console.timeEnd('parse'); console.log(ret); btn.innerText = 'done'; return [2 /*return*/]; } }); }); } //# sourceMappingURL=parse-xtc.js.map