Created
June 12, 2012 04:07
-
-
Save egomez99/2914859 to your computer and use it in GitHub Desktop.
Non Stack overflow when circular referencing commonJS modules
This file contains hidden or 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
var MyWindow = require('somewindow'); | |
MyWindow().open(); |
This file contains hidden or 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
exports.Info = function(text){ | |
var UI = require('ui'); | |
Ti.API.info(text); | |
} |
This file contains hidden or 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
module.exports = function(){ | |
var UI = require('ui'); | |
return UI.Win(); | |
} |
This file contains hidden or 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
exports.View = function(){ | |
var Log = require('log'); | |
Log.Info('Hello World, this is a view'); | |
return Ti.UI.createView(); | |
} | |
exports.Win = function(){ | |
var Log = require('log'); | |
Log.Info('Hello World, this is a window'); | |
return Ti.UI.createWindow(); | |
} | |
//Do not try this! | |
//var Log = require('log'); | |
//Log.Info('Hello World, this is a window - Outside the exports'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment