Created
August 9, 2012 06:13
-
-
Save Raynos/3301572 to your computer and use it in GitHub Desktop.
Can this be one file?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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