Skip to content

Instantly share code, notes, and snippets.

@btipling
Created April 24, 2011 20:41
Show Gist options
  • Save btipling/939863 to your computer and use it in GitHub Desktop.
Save btipling/939863 to your computer and use it in GitHub Desktop.
Circular reference
//File a.js:
var b = require('./b');
exports.A = function () {
console.log('A');
b.B();
};
//File b.js:
var a = require('./a');
var A;
//A = a.A; <--- can't do this
exports.B = function () {
console.log('B');
A = a.A; // <-- can do this
console.log('A ->', A);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment