JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1814
  • Score
    100M100P100Q113781F
  • License MIT

synthetic asynchronous processing in javascript

Package Exports

  • thaw.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (thaw.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Thaw.js

Join the chat at https://gitter.im/robertleeplummerjr/thaw.test.ts

synthetic asynchronous processing in javascript

Thaw.js helps keep the browser from freezing by splitting long computations into small parts which are processed more naturally when the browser isn't busy. This simulates asynchronous behaviour and attempts to keep the browser from freezing. Thaw.ts thaws frozen browsers.

tip for next commit

Usage

import { thaw } from 'thaw.js';
import { matrixMultiply } from 'fake-math-library';

let lastMatrix;
const items = [];
for (let i = 0; i < 1000000; i++) {
  items.push(() => {
    lastMatrix = matrixMultiply(a, b);
  });
}

// start thawing!
const t = thaw(items);

//sometime later
t.add(item); // append single function to end of all tasks
t.insert(item); // insert single function after current task
t.addArray(items); // append array of functions to end of all tasks
t.insertArray(items); // insert array of functions after current task

// sometime perhaps even more later
t.stop(); // stop all tasks on this instance of thaw from thawing
t.stopAll(); // stop ALL INSTANCES of thaw from thawing

Block Usage

A "block" is a set number of thaw instances, so that setTimeout doesn't get over used. This can lead to better performance in some cases.

import { Block } from 'thaw';
const thaws = new Block(thawOptions, count);