This shows circular refs working.
Last active
October 20, 2016 16:46
-
-
Save matthewp/63edaf2177374e4aaeecede68e54c8df to your computer and use it in GitHub Desktop.
Circular refs example
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
node_modules/ |
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
<title>Circular deps with steal()</title> | |
<script src="node_modules/steal/steal.js"></script> |
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
steal("./one.js", "./two.js", function(one, two){ | |
console.log(one.hello(), two.world()); | |
}); |
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
define(["exports","./two"], function(exports, two){ | |
exports.hello = function(){ | |
return two.hello; | |
}; | |
exports.world = "world"; | |
}); |
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
{ | |
"name": "circulars", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "git+ssh://git@gist.github.com/63edaf2177374e4aaeecede68e54c8df.git" | |
}, | |
"author": "", | |
"license": "ISC", | |
"bugs": { | |
"url": "https://gist.github.com/63edaf2177374e4aaeecede68e54c8df" | |
}, | |
"homepage": "https://gist.github.com/63edaf2177374e4aaeecede68e54c8df", | |
"dependencies": { | |
"steal": "^0.16.41" | |
} | |
} |
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
define(["exports", "./one"], function(exports, one){ | |
exports.hello = "hello"; | |
exports.world = function(){ | |
return one.world; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment