CommonJS for OOP in Appcelerator Titanium
Is it good practice to write all javascript "classes" as CommonJS modules within an Appcelerator Titanium Mobile app instead of using functions / object notation to create a new "class" (or how you call them in javascript anyway)?
var module = require('lib/module');
instead of
var object = new MyClass();
Are there any disadvantages?
I do not believe it is completely supported on all platforms and all versions of the SDK at this time.
See this issue in QA Forum
http://developer.appcelerator.com/question/125373/common-js-modules---no-build-on-device
and
http://developer.appcelerator.com/question/124473/commonjs-modules---typeerror-in-production#answer-218739
链接地址: http://www.djcxy.com/p/96604.html上一篇: 管理CommonJS模块的问题