Module Development - Getting '[undefined] is not an object' in 1.3.2 and head
Trying to develop a module using the walkthrough document and everything works as expected all the way up until I try and use the module, where I get an "[undefined] is not an object" error. I know this was an issue in previous versions of Titanium, but I thought it had been fixed. Tried it with 1.3.2, and built from head at around 1pm today, but no luck. Has this regressed recently?
I see this in the log which leads me to believe the my "TestingModule" module loaded successfully:
"[INFO] Detected third-party module: testingmodule/0.1"
But this fails:
var test = Titanium.Testing;
Any help is greatly appreciated. Under a time constraint here and really need to develop a critical module.
1 Answer
-
Hey Alan,
We're making some changes to the Module SDK and haven't yet posted some of the docs yet.
You should be able to use
var mymodule = require("testingmodule");
Now as the syntax. We're moving to common js syntax to prevent namespace issues. Also, you'll want to move to using dotted notation naming. The new syntax will use the module id (such as com.foo.bar) in the require statement.