{ "id": "108326", "key": "ALOY-506", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2013-01-21T20:46:58.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "alloy", "compiler" ], "versions": [ { "id": "14631", "description": "Alloy 0.3.1", "name": "Alloy 0.3.1", "archived": false, "released": true, "releaseDate": "2012-11-02" } ], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:26:11.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "13605", "name": "Models" }, { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" } ], "description": "Hi Tony,\r\n\r\nWe need to figure out a way to add hooks to execute code before markup are rendered. \r\n\r\nYou wrote: \r\n\r\nThere _needs_ to be a way to execute code before the markup. Unfortunately, this is likely going to require some restructuring in order to maintain valid JS in the developer-written controller code while maintaing their simplicity. Right now controllers are a flat chunk of Javascript. To effectively allow for lifecycle events like \"preUI\" that need to be executed out of order, a more strict commonjs structure might need to be created for the controllers. Something like this:\r\n\r\n\texports.preUI = function($) {\r\n\t // code executed before UI is created, has access to $\r\n\t // but it has not been populated by UI creation yet.\r\n\t // $ would be an empty object at this point. you can\r\n\t // initialize models/collections for binding, \r\n\t // dynamically updated styles before they are applied,\r\n\t // handle Mads' use case, etc...\t\r\n\t}\r\n\r\n\texports.ready = function($) {\r\n\t // this would be the normal controller code, it has\r\n\t // access to the populated $ variable.\r\n\t}\r\n\r\n\texports.someProperty = 'skjhdsdjhfjksd';\r\n\texports.someCustomFunction = function() {\r\n\t // export functions & vars just like you did before\r\n\t}\r\n\r\nI believe this only should be optional. No need for beginners to know this kind of functionality. \r\n\r\n", "attachment": [], "flagged": false, "summary": "Alloy: Adding hooks for pre UI code", "creator": { "name": "viezel", "key": "viezel", "displayName": "Mads Moller", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "viezel", "key": "viezel", "displayName": "Mads Moller", "active": true, "timeZone": "Europe/Berlin" }, "environment": "3.0", "comment": { "comments": [ { "id": "327002", "author": { "name": "ppritchard", "key": "ppritchard", "displayName": "Peter Eddy Pritchard", "active": true, "timeZone": "America/Los_Angeles" }, "body": "is this a duplicate of ALOY-744? the same proposed solution works for ALOY-1037 and other issues as well (see comments in related issues) ", "updateAuthor": { "name": "ppritchard", "key": "ppritchard", "displayName": "Peter Eddy Pritchard", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-05T04:34:10.000+0000", "updated": "2014-10-05T04:35:57.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }