Browse Source

renamed mol-comp to mol-task

David Sehnal 7 years ago
parent
commit
1d07b6a0dd

+ 1 - 1
README.md

@@ -7,7 +7,7 @@
 
 ## Module Overview
 
-- `mol-comp` Computation abstraction with progress tracking and cancellation support.
+- `mol-task` Computation abstraction with progress tracking and cancellation support.
 - `mol-data` Collections (integer based sets, inteface to columns/tables, etc.)
 - `mol-math` Math related (loosely) algorithms and data structures.
 - `mol-io` Parsing library. Each format is parsed into an interface that corresponds to the data stored by it.

+ 0 - 0
src/mol-comp/computation.ts → src/mol-task/computation.ts


+ 0 - 0
src/mol-comp/context.ts → src/mol-task/context.ts


+ 0 - 0
src/mol-comp/index.ts → src/mol-task/index.ts


+ 0 - 0
src/mol-comp/scheduler.ts → src/mol-task/scheduler.ts


+ 0 - 0
src/mol-comp/time.ts → src/mol-task/time.ts


+ 0 - 0
src/mol-comp/util.ts → src/mol-task/util.ts


+ 11 - 5
src/perf-tests/structure.ts

@@ -29,15 +29,21 @@ async function readData(path: string) {
     }
 }
 
-function *test() {
-    yield 10;
-    return 15;
+(Symbol as any).asyncIterator = (Symbol as any).asyncIterator || Symbol.for('Symbol.asyncIterator');
+
+interface ProgressGenerator<T> extends AsyncIterableIterator<number | T> {
+    next(cont?: boolean): Promise<IteratorResult<number | T>>
+}
+
+async function *test(): ProgressGenerator<boolean> {
+    const r = yield await new Promise<number>(res => res(10));
+    return r;
 }
 
-async function runIt<T>(itP: () => IterableIterator<T>) {
+async function runIt(itP: () => ProgressGenerator<boolean>) {
     const it = itP();
     while (true) {
-        const { value, done } = it.next();
+        const { value, done } = await it.next(true);
         if (done) return value;
     }
 }

+ 1 - 1
tsconfig.json

@@ -9,7 +9,7 @@
         "strictNullChecks": true,
         "strictFunctionTypes": true,
         //"downlevelIteration": true,
-        "lib": [ "es6", "dom" ],
+        "lib": [ "es6", "dom", "esnext.asynciterable" ],
         "outDir": "build/node_modules",
         "baseUrl": "src",
         "paths": {