Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created August 9, 2012 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/3301572 to your computer and use it in GitHub Desktop.
Save Raynos/3301572 to your computer and use it in GitHub Desktop.
Can this be one file?
var lazynode = require("lazynode")
, mdm = require("./index")
, rack = require("hat").rack(128, 16, 16)
module.exports = lazynode.connect({
createStream: createStream
, methods: ["add", "get"]
})
function createStream() {
return mdm.createStream("/browserList/" + rack())
}
var lazynode = require("lazynode")
, list = []
module.exports = browserList
function browserList(stream) {
var up = lazynode({
add: function (id, cb) {
list.push(id)
cb && cb(null)
}
, get: function (cb) {
cb(list)
}
})
up.pipe(stream).pipe(up)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment