Signal represents collection of values (over time) associated with a single identity. It can be expressed as follows:
function signal(next) {
next(1)
next(2)
next(3)
// Load the TCP Library | |
net = require('net'); | |
// Keep track of the chat clients | |
var clients = []; | |
// Start a TCP Server | |
net.createServer(function (socket) { | |
// Identify this client |
// A pull stream is a function readable(closing, cb<err, chunk>) | |
// To extract a chunk out of the stream simply call (null, cb) | |
// to get another value call it again. | |
// The stream will tell you if it's ended by invoking cb(true) | |
// The stream will tell you if it errored by invoking cb(Error) | |
// You can tell the stream to close / destroy by calling stream(true, cb) | |
var stream = (function () { | |
var list = [1, 2, 3, 4] | |
return function stream(closing, callback) { |
// The well-known callback pattern | |
fs.mkdir("some-path", function(err) { | |
fs.open("some-path/file", "w", function(err, fd) { | |
var buffer = new Buffer("hello world") | |
fs.write(fd, buffer, 0, buffer.length, null, function(err, bytes) { | |
console.log("Wrote " + bytes + " bytes") | |
}) | |
}) | |
}) |
var lines = require('line-stream') | |
, through = require('through') | |
, emit = require('emit-function') | |
, duplex = require('duplex') | |
module.exports = json | |
function json(transport) { | |
var input = through(write) | |
, output = through(recv) |
var parseScope = require('lexical-scope'); | |
var browserResolve = require('browser-resolve'); | |
var commondir = require('commondir'); | |
var through = require('through'); | |
var mdeps = require('module-deps'); | |
var path = require('path'); | |
var processModulePath = require.resolve('process/browser.js'); | |
module.exports = function (files, opts) { |
var WriteStream = require("write-stream") | |
var toArray = require("write-stream/array") | |
/************************************** A *************************************/ | |
db.readStream().pipe(WriteStream(function write(data) { | |
assert.equal(data, { | |
value: 'value', | |
key: 'key' | |
}) |
-var pad = function(decimal){ return decimal.toFixed(2); }; | |
h2 Hi NoNuby | |
div!= pad(locals.val1); | |
div!= pad(locals.val2); |
var assert = require("TAP-winning/assert")() | |
assert.equal() ... | |
setTimeout(function () { | |
assert.end() | |
}, 1000) |
pipe(stream('water'), [ | |
stream('bathroom'), [ | |
stream('sink'), | |
stream('toilet') | |
], | |
stream('kitchen'), [ | |
stream('sink'), | |
stream('dishwasher') | |
], | |
]) |