{ "id": "82779", "key": "TIMOB-6202", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2012-01-16T12:06:43.000+0000", "created": "2011-11-16T09:54:09.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "stage" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [], "assignee": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "updated": "2014-01-28T23:57:35.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "In Ti._5.createClass(), if the class definition (value) is not a function, it defaults the definition to \"new Object()\". This works fine, however if you try to create a new instance of this class, it throws a JavaScript error.", "attachment": [], "flagged": false, "summary": "MobileWeb: Creating new classes without a definition throws error when instantiating", "creator": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "172934", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Turns out there is inconsistent use of createClass(). Sometimes it's used to create an instantiable object with the \"new\" operator such as when:\r\n\r\n{code}\r\nTi._5.createClass('Titanium.UI.Button', function(){ ... });\r\n\r\nvar button = new Titanium.UI.Button();\r\n{code}\r\n\r\nThere are other times when createClass() is used to create a non-instantiable object that fails if you do a \"new\" operator:\r\n\r\n{code}\r\nTi._5.createClass('Titanium.API');\r\n\r\nvar api = Titanium.API;\r\napi.something = true;\r\n\r\nvar foo = new Titanium.API(); // throws error\r\n{code}\r\n\r\nProbably best to solve this by creating a new method called createObject() to explicitly differentiate between objects and classes:\r\n\r\n{code}\r\nTi._5.createObject('Titanium.API');\r\n{code}", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2011-11-16T10:45:33.000+0000", "updated": "2011-11-16T10:45:33.000+0000" }, { "id": "172944", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "Bryan and I discussed and we agree this should be separated. Start by renaming createClass() to declare(). As for createObject(), perhaps something like getObject() or object() or obj()?", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2011-11-16T11:17:19.000+0000", "updated": "2011-11-16T11:17:19.000+0000" }, { "id": "172947", "author": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I don't have a strong preference, but I think I am leaning towards object(). Aesthetically it seems to compliment declare() the best.", "updateAuthor": { "name": "bhughes", "key": "bhughes", "displayName": "Bryan Hughes", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-11-16T11:20:59.000+0000", "updated": "2011-11-16T11:20:59.000+0000" }, { "id": "179419", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "This entire issue has been eliminated since rolling out the new class hierarchy in TIMOB-6772.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2012-01-16T12:06:43.000+0000", "updated": "2012-01-16T12:06:43.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }