I've started looking into Appcelerator 1.8.0 few days and back and i'm a little confused with Ti.include and require. As i understand, Ti.include is used to include content of a js file in another file, and require is used to get the public api exposed using exports. What i'm not able to understand is if require-export can be used to get hold of public API's do you really need include? Basically i'm trying to understand different between include and require?
September 2022) Titanium SDK is an open-source framework that allows the creation of native mobile apps on platforms including iOS, Android and Windows UWP from a single JavaScript codebase, developed by Appcelerator.
You can get started with Appcelerator for development purposes for free!
Titanium is a product by a company called Appcelerator that allows you to build mobile apps in JavaScript and compile it out to native apps for iOS, Android, and BlackBerry.
Titanium Studio is an all inclusive powerful Eclipse-based IDE, that simplifies the mobile development process. Use Titanium Studio to rapidly build, test, package and publish mobile, desktop and web applications.
Ti.require uses the CommonJS specification. Although files accessed via Ti.require have access to the Ti namespace, they do not have access to the Global namespace - any variables or functions you have declared in the main program. Ti.include files do have access to the global space and can modify or add to it. Ti.require is preferred, but not always practical. See https://wiki.appcelerator.org/display/guides/CommonJS+Modules+in+Titanium for information on the Ti.require function and https://wiki.appcelerator.org/display/guides/Mobile+Best+Practices for more best practices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With