Eliasdx
Eliasdx

Reputation: 2180

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?

Upvotes: 3

Views: 1560

Answers (1)

Aaron Saunders
Aaron Saunders

Reputation: 33345

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

Upvotes: 2

Related Questions