Skip to content

iirvine/render-queue-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

render-queue-stream

In short, a streamable version of Kai Chang's render-queue.js.

var RenderQueue = require('render-queue-stream');	
var someStreamOfData = require('./MyStream');

someStreamOfData.pipe(RenderQueue(function(data) { render(data); }).rate(50));

function render(data) {
	// do something to render small chunks of data to screen
}

api

RenderQueue(fn)

Creates a writable stream. When data is written to the stream a render loop will begin that will invoke fn with rate slices of data per frame via requestAnimationFrame to keep the page responsive.

When all of the data is queued, the render loop will continue until the remaining data is below a certain threshold (defaults to rate * 100), at which point the render function will be invoked with the remainder of the queue.

stream.rate(num)

Get or set the number of data entries to be rendered each frame.

stream.threshold(num)

Get or set the threshold value. Once all data is queued and the buffer reaches this threshold, the render function will be called with the remainder of the queue.

stream.remaining()

Returns current length of the animation queue.

About

a render-queue you can pipe() to!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published