Sha256: b1d6e2dfb2cea892a1596df7fe84300b8ffb447d077977e02345a7d942b79e1b

Contents?: true

Size: 629 Bytes

Versions: 173

Compression:

Stored size: 629 Bytes

Contents

var from = require('from')
var through = require('../')

var tape = require('tape')

tape('simple async example', function (t) {
 
  var n = 0, expected = [1,2,3,4,5], actual = []
  from(expected)
  .pipe(through(function(data) {
    this.pause()
    n ++
    setTimeout(function(){
      console.log('pushing data', data)
      this.push(data)
      this.resume()
    }.bind(this), 300)
  })).pipe(through(function(data) {
    console.log('pushing data second time', data);
    this.push(data)
  })).on('data', function (d) {
    actual.push(d)
  }).on('end', function() {
    t.deepEqual(actual, expected)
    t.end()
  })

})

Version data entries

173 entries across 149 versions & 18 rubygems

Version Path
pcp-server-ruby-sdk-0.0.6 node_modules/through/test/async.js
pcp-server-ruby-sdk-0.1.0 node_modules/through/test/async.js
reed_sdk-1.0.1 node_modules/through/test/async.js
reed_sdk-1.0.0 node_modules/through/test/async.js
isomorfeus-puppetmaster-0.5.5 node_modules/through/test/async.js
isomorfeus-puppetmaster-0.5.4 node_modules/through/test/async.js
isomorfeus-puppetmaster-0.5.3 node_modules/through/test/async.js
isomorfeus-puppetmaster-0.5.2 node_modules/through/test/async.js
isomorfeus-puppetmaster-0.5.1 node_modules/through/test/async.js
isomorfeus-puppetmaster-0.5.0 node_modules/through/test/async.js
ilog-0.4.1 node_modules/through/test/async.js
ilog-0.4.0 node_modules/through/test/async.js
ilog-0.3.3 node_modules/through/test/async.js
govuk_publishing_components-18.0.0 node_modules/through/test/async.js
govuk_publishing_components-17.21.0 node_modules/through/test/async.js
govuk_publishing_components-17.20.0 node_modules/through/test/async.js
govuk_publishing_components-17.19.1 node_modules/through/test/async.js
govuk_publishing_components-17.19.0 node_modules/through/test/async.js
govuk_publishing_components-17.18.0 node_modules/through/test/async.js
govuk_publishing_components-17.17.0 node_modules/through/test/async.js