Include Once or Import
Hello!
Is there an import (C style) or include_once (PHP style) statement for mobile?
I tend to use include files that appear to get 'included' more than once which presumably takes a performance hit.
There doesn't appear to be one documented but I'd love to see it. Anyone else?
4 Answers
-
This is the standard include statement. I'm looking for an include "once" to stop the file getting included multiple times if it's called multiple times.
http://developer.appcelerator.com/apidoc/mobile/1.2/Titanium.include.html
Thanks
Charlie -
Ti.include('yourfile.js')
-
Any update on this to inlcude a file once?
-
I guess you would need to make your own function include_once() which you would always call instead of include() - and that function would keep a list previously included files, and if the current file asking to be included is already in the list, then skip the include() statement…