Permalink
Browse files

[dist] Added more examples

  • Loading branch information...
1 parent 875ba8f commit 9e6efc0c12705516441dd44927c38fe26659c61d @Marak Marak committed Jan 1, 2012
Showing with 46 additions and 0 deletions.
  1. +19 −0 example/resolve-circular-links.js
  2. +27 −0 example/save-data.js
@@ -0,0 +1,19 @@
+var Hnet = require('../lib/hnet').Hnet;
+
+var hnet = new Hnet({
+ circularDelay: 5000
+});
+
+hnet.on('node', function (node, data, options) {
+ console.log('level::' + options.currentDepth + '::' + node.uri);
+});
+
+hnet.on('level::*', function(nodes, options){
+ console.log('level::' + this.event.split('::')[1] + '::loaded');
+ console.log(JSON.stringify(hnet.get(), true, 2));
+});
+
+//
+// Will start lazy loading sources
+//
+hnet.load(['http://hnet.iriscouch.com/public/0']);
View
@@ -0,0 +1,27 @@
+//
+// TODO: not complete
+//
+
+
+var Hnet = require('../lib/hnet').Hnet;
+
+var hnet = new Hnet();
+
+//
+// Will start lazy loading sources
+//
+hnet.set([
+ {
+ uri: "http://hnet.iriscouch.com/public/4",
+ type: "couchdb",
+ data: { "foo":"bar" }
+ }
+], function(err, response, body){
+ console.log('fff')
+ if (err) {
+ console.log(err);
+ }
+
+ console.log(body);
+
+});

0 comments on commit 9e6efc0

Please sign in to comment.