Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inside the generated controllers it looks like this:
and after that it will add the code of the controller. Currently there is no way (unless someone knows one) to put controller code before creating all the UI code which e.g. calls
createController
and creates sub controllers already.Only Backbone collections are before the UI code.
Alloy already provides a
pre
field for "pre code" stuff but it is not used.This PR will add a way to use a method called
__pre()
to fill that property. So all you code insidefunction __pre(){}
will be added before the// Generated UI code
section.Example:
function __pre(){console.log("index");}
into index.js"index" should be logged before "controller"
Note
We can change the name of the method to something else like
__alloy_preCode
or so. Just to make it more unlikely to cause conflicts with existing function names.