Skip to content

Commit

Permalink
Remove generators, clean up REGL intantiation, expose more types. (#2)
Browse files Browse the repository at this point in the history
* Removing support for generator functions (unused).

* Adding traceDeprecation to webpack for debugging deprecation warnings.

* Cleaning up REGL instatiation.

* Exposing more types via TypeScript module.

* Incrementing patch version to 0.1.2.
  • Loading branch information
jimbojw authored Apr 13, 2022
1 parent be854aa commit 3f4e5ac
Show file tree
Hide file tree
Showing 24 changed files with 90 additions and 484 deletions.
1 change: 0 additions & 1 deletion dist/megaplot-v0.1.1.es2015.min.js.map

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15476,12 +15476,6 @@ void main () {
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Grab a reference to the JavaScript generator function constructor class.
* While the Function class is available in the global/window scope, neither
* GeneratorFunction nor AsyncFunction are available.
*/
const GeneratorFunction = (function* () { }).constructor;
/**
* Default settings to control the WorkScheduler's behavior. These can be
* overridden in the WorkScheduler constructor.
Expand Down Expand Up @@ -15733,54 +15727,23 @@ void main () {
this.futureWorkQueue.enqueueTask(task);
continue;
}
// Immediately following this line, either the callback function will be
// called, or a previously created iterator will be invoked.
tasksRan++;
if (!task.iterator) {
const result = task.callback.call(null, remaining);
// Check to see if this was anything other than a generator.
if (task.callback.constructor !== GeneratorFunction) {
if (!task.runUntilDone || result) {
// Task was a simple callback function, nothing left to do.
continue;
}
// Task is not finished, so keep running it until either it finishes
// or we run out of time.
let done = result;
while (!done && remaining() > 0) {
done = task.callback.call(null, remaining);
}
if (!done) {
// The task did not finish! Schedule the task to continue.
this.futureWorkQueue.enqueueTask(task);
}
continue;
}
// Sanity check. At this point, the result value must be an iterator
// produced by a generator function. Had the callback been a non-
// generator function, then the loop would have been escaped already
// from within the preceding block.
if (!result || typeof result !== 'object' || result === null ||
!(result.constructor instanceof Function) ||
result.constructor.constructor !== GeneratorFunction) {
throw new Error('Generator function did not return an iterator.');
}
// Replace the task with a copy but including the iterator for future
// invocation.
const iterator = result;
task = Object.freeze(Object.assign(Object.assign({}, task), { iterator }));
const result = task.callback.call(null, remaining);
if (!task.runUntilDone || result) {
// Task was a simple callback function, nothing left to do.
continue;
}
// Start running down the iterator until it finishes or time runs out.
let done = false;
while (!done) {
done = task.iterator.next().done;
if (remaining() <= 0) {
break;
}
// Task is not finished, so keep running it until either it finishes
// or we run out of time.
let done = result;
while (!done && remaining() > 0) {
done = task.callback.call(null, remaining);
}
if (!done) {
// The iterator did not finish! Schedule the task for further work.
// The task did not finish! Schedule the task to continue later.
this.futureWorkQueue.enqueueTask(task);
// Since the task didn't finish, we must have run out of time.
break;
}
}
}
Expand Down Expand Up @@ -15962,7 +15925,7 @@ void main () {
// Look for either the REGL module or createREGL global since both are
// supported. The latter is for hot-loading the standalone Regl JS file.
const win = window;
const createREGL = (win['REGL'] || win['createREGL']) || regl;
const createREGL = win['createREGL'] || regl;
if (!createREGL) {
throw new Error('Could not find REGL.');
}
Expand Down Expand Up @@ -16513,4 +16476,4 @@ void main () {
Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=megaplot-v0.1.1.bundle.es2015.js.map
//# sourceMappingURL=megaplot-v0.1.2.bundle.es2015.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

65 changes: 14 additions & 51 deletions dist/megaplot-v0.1.1.es2015.js → dist/megaplot-v0.1.2.es2015.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f4e5ac

Please sign in to comment.