[ALOY-295] Need bootstrap hooks in the app
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-10-01T21:01:17.000+0000 |
Affected Version/s | 2012 Sprint 19 |
Fix Version/s | 2012 Sprint 20, Release 3.0.0 |
Components | Runtime, XML |
Labels | n/a |
Reporter | Rick Blalock |
Assignee | Unknown |
Created | 2012-09-24T15:09:20.000+0000 |
Updated | 2018-03-07T22:25:39.000+0000 |
Description
There needs to be a way to have events or hooks in to the app lifecycle. Here's a scenario: Currently Alloy.isTablet applies to anything from 7" and above. A common scenario for app developers is a 7" tablet should use the handheld layout. So I need to override Alloy.isTablet to only apply to tablets larger than 7". Currently there is no way for me to modify this in Alloy. The only way I can think of these types of overrides working is to allow us to change things in the Alloy module and others inside the bootstrap.
Seems like an "alloy'js" file at the root of the app directory, which is executed _after_ the main CFG is loaded, but _before_ the index controller is created, would cover 90% of the use cases. It would provide a simple way for developers to execute code in their app before any controllers are loaded, or styles are applied. This would also give you the opportunity to override
Alloy.isTablet
andAlloy.isHandheld
before they are ever used."app/alloy.js" file contents will be inserted directly into the new app.js template, which now looks like this: