Skip to content

Instantly share code, notes, and snippets.

@eddyb
Forked from jeffmarshall/gist:5420414
Last active December 16, 2015 10:29
Show Gist options
  • Save eddyb/5420427 to your computer and use it in GitHub Desktop.
Save eddyb/5420427 to your computer and use it in GitHub Desktop.
function A() {
this.type = 'a'
}
module.exports = A;
var B = require('./b.js');
A.prototype.delete = function deleteA(callback) {
var self = this;
self.findAllBs(function(err, res) {
res.forEach(function(b) {
var b = new B(b);
b.delete();
});
});
}
function B() {
this.type = 'b'
}
module.exports = B;
var A = require('./a.js');
B.prototype.read = function readB(callback) {
var self = this;
var myA = new A(self.a)
myA.read(function(err, res) {
return callback(null, 'My A:'+ res);
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment