thaw.js

synthetic asynchronous processing in javascript
(Now with extra anti-freeze!)

Browsers are synchronous. They have limits & can be slow. thaw.js defers processes until the browser is ready for them.
thaw.js makes frozen browsers thaw(.js).

Thaw.js is like the idea of javascript promises only tied to time.

Shouldn't I just use a web worker?

You could, if you don't care about the DOM. Unfortunately the DOM does exist, and it is synchronous. Web workers do not have access to anything synchronous, including the DOM.

Demo

You are in one right now! Scroll to bottom to see.
There are 2 million div elements being appended to this very document from three separate thaw calls happening right now, 6 million total. Does your browser seem slow or sluggish? Of course not! It is thaw(.js)ing.



Usage

With Functions:

new Thaw([
	function() {},
	function() {}
]);

With Arrays:

new Thaw([], {
	each:function(i) {
		//this = item of array
	},
	done: function() {
		//this = item of array
	}
});

As a block or Thaws (can be even faster in some situations):

new Thaw.Block({
	each:function(i) {
	//this = item of array
	},
	done: function() {
	//this = item of array
	}
}, 200);

Methods

Written by

Robert Lee Plummer Jr.

License

MIT


Fork me on GitHub