Skip to content

Commit

Permalink
[dist] Added more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Marak committed Jan 1, 2012
1 parent 875ba8f commit 9e6efc0
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
19 changes: 19 additions & 0 deletions example/resolve-circular-links.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']);
27 changes: 27 additions & 0 deletions example/save-data.js
@@ -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.