-
-
Save eddyb/5420427 to your computer and use it in GitHub Desktop.
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
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(); | |
}); | |
}); | |
} |
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
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