Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

text-content-stream Build Status

NPM

Pipe a stream into a HTML element, overwriting textContent with the latest chunk. A new animation frame is requested on each write as to not choke the browser.

Usage

example.js:

var stream = require('stream');

var dataStream = new stream.Readable();
dataStream._read = function() {
  this.push('' + Math.random());
}


var document = require('global/document');
var textContentStream = require('text-content-stream');

var elm = document.createElement('span');
document.body.appendChild(elm);

dataStream.pipe(textContentStream({element: elm}));

License

Copyright (c) 2015, Umwelt A/S

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

About

Pipe a stream into a HTML element, overwriting textContent with the latest chunk

Resources

License

You can’t perform that action at this time.