I would understand the exact order of execution about "Lightning Component Rendering Lifecycle" and JS static resource.
For example, we have this First Scenario.
Alpha.cmp:
<aura:component>
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<ltng:require scripts="{!$Resource.jsResource}" afterScriptsLoaded="{!c.jsLoaded}" />
</aura:component>
Alpha.js
({
doInit: function (component, event, helper) {
console.log('doInit');
},
jsLoaded: function(component, event, helper) {
console.log('jsLoaded');
}})
Who is the order of printing on the console?
In the Second Scenario, I would use a JS static resource (Lealeft.js for example) but I would use some attribute passed by a parent component.
Beta.cmp
<aura:component>
<aura:attribute name="Tom" type="String"/>
<ltng:require scripts="{!$Resource.jsResource}" afterScriptsLoaded="{!c.jsLoaded}" />
</aura:component>
Beta.js
({
jsLoaded: function (component, event, helper) {
console.log('Tom=' + component.get("v.Tom"));
}
}})
Is always true that afterScriptLoaded is executed when Rendering LifeCycle is finished?
This topic is very obscure for me! Thanks