Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Android - What is the best way to create window?

$
0
0

Hi all,

Please see my below example:

//METHOD 1
//windows.js 
exports.Window = function(e){
    return Ti.UI.createWindow(e);
};
//app.js
var UI = require('window');
var win = UI.Window({backgroundColor:'#999'});
win.open();
 
//METHOD 2
//windows.js
function create_window(e){
    return Ti.UI.createWindow(e);
}
//app.js
Ti.include('windows.js'); // This Ti.include will be deprecated, so any other way to include a js file?
var win = create_window({backgroundColor:'#999'});
win.open();
Base on http://docs.appcelerator.com/titanium/3.0/#!/guide/Coding_Best_Practices-section-30082362_CodingBestPractices-Deferscriptloading we should follow method 1. But what is the different here? Actually the two methods are same each other, why we need to follow method 1?

Another small question is "Ti.include will be deprecated, so any other way to include a js file?"

Thank you so much for all your help!


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>