Titanium JIRA Archive
Alloy (ALOY)

[ALOY-295] Need bootstrap hooks in the app

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusResolved
ResolutionFixed
Resolution Date2012-10-01T21:01:17.000+0000
Affected Version/s2012 Sprint 19
Fix Version/s2012 Sprint 20, Release 3.0.0
ComponentsRuntime, XML
Labelsn/a
ReporterRick Blalock
AssigneeUnknown
Created2012-09-24T15:09:20.000+0000
Updated2018-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.

Comments

  1. Tony Lukasavage 2012-09-24

    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 and Alloy.isHandheld before they are ever used.
  2. Tony Lukasavage 2012-10-01

    "app/alloy.js" file contents will be inserted directly into the new app.js template, which now looks like this:
       /**
        * Alloy for Titanium by Appcelerator
        * This is generated code, DO NOT MODIFY - changes will be lost!
        * Copyright (c) 2012 by Appcelerator, Inc.
        */
       var Alloy = require('alloy'),
       	_ = require('alloy/underscore')._;
       
       Alloy.CFG = require('alloy/CFG');
       <%= alloyJs %>
       Alloy.createController('index');
       

JSON Source