Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-506

Alloy: Adding hooks for pre UI code


    • Type: New Feature
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: Alloy 0.3.1
    • Fix Version/s: None
    • Component/s: Models, Runtime
    • Labels:
    • Environment:



      Hi Tony,

      We need to figure out a way to add hooks to execute code before markup are rendered.

      You wrote:

      There 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:

      exports.preUI = function($)

      { // code executed before UI is created, has access to $ // but it has not been populated by UI creation yet. // $ would be an empty object at this point. you can // initialize models/collections for binding, // dynamically updated styles before they are applied, // handle Mads' use case, etc... }

      exports.ready = function($)

      { // this would be the normal controller code, it has // access to the populated $ variable. }

      exports.someProperty = 'skjhdsdjhfjksd';
      exports.someCustomFunction = function()

      { // export functions & vars just like you did before }

      I believe this only should be optional. No need for beginners to know this kind of functionality.




            • Assignee:
              viezel Mads Moller
            • Watchers:
              5 Start watching this issue


              • Created:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration