Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

working dnode example

  • Loading branch information...
commit 42f3932eea16e0322d7341df3be3009e28f9d57d 1 parent ee492d6
@substack authored
View
2  example/dnode/Makefile
@@ -0,0 +1,2 @@
+all:
+ node_modules/.bin/browserify client.js -o static/bundle.js
View
16 example/dnode/client.js
@@ -0,0 +1,16 @@
+var domready = require('domready');
+var shoe = require('../../');
+var dnode = require('dnode');
+
+domready(function () {
+ var result = document.getElementById('result');
+ var stream = shoe('/dnode');
+
+ var d = dnode();
+ d.on('remote', function (remote) {
+ remote.transform('beep', function (s) {
+ result.textContent = 'beep => ' + s;
+ });
+ });
+ d.pipe(stream).pipe(d);
+});
View
11 example/dnode/package.json
@@ -0,0 +1,11 @@
+{
+ "name" : "shoe-dnode-example",
+ "version" : "0.0.0",
+ "dependencies" : {
+ "browserify" : "~1.13.0",
+ "ecstatic" : "~0.1.6",
+ "domready" : "~0.2.11",
+ "dnode" : "~1.0.0"
+ },
+ "private" : true
+}
View
19 example/dnode/server.js
@@ -0,0 +1,19 @@
+var shoe = require('../');
+var dnode = require('dnode');
+
+var http = require('http');
+var ecstatic = require('ecstatic')(__dirname + '/static');
+
+var server = http.createServer(ecstatic);
+server.listen(9999);
+
+var sock = shoe(function (stream) {
+ var d = dnode({
+ transform : function (s, cb) {
+ var res = s.replace(/[aeiou]{2,}/, 'oo').toUpperCase();
+ cb(res);
+ }
+ });
+ d.pipe(stream).pipe(d);
+});
+sock.install(server, '/dnode');
View
2  example/dnode/static/index.html
@@ -0,0 +1,2 @@
+<script src="/bundle.js"></script>
+<div id="result"></div>
Please sign in to comment.
Something went wrong with that request. Please try again.