I am trying to load a classic console related library only when the a Lightning Component is running in a VisualForce container. Unfortunately, adding the ltng:require component dynamically does not make the library available nor is the afterScriptLoaded method executed. Should this work?
Here is the helper function I am calling:
loadClassicLibrary : function(component) {
$A.createComponent(
"ltng:require",
{
"scripts": '/support/console/46.0/integration.js',
"afterScriptsLoaded": component.getReference("c.classicConsoleInit")
},
function(scriptComp, status, errorMessage){
//Add the new button to the body array
if (status === "SUCCESS") {
var body = component.get("v.body");
body.push(scriptComp);
component.set("v.body", body);
console.log("'navigation: Helper: loadClassicLibrary: component added.", JSON.stringify(scriptComp));
}
else if (status === "INCOMPLETE") {
console.log("'navigation: Helper: loadClassicLibrary: No response from server or client is offline.")
// Show offline error
}
else if (status === "ERROR") {
console.log("navigation: Helper: loadClassicLibrary: Error: " + errorMessage);
// Show error message
}
}
);
},
Per the browser console, the script file is accessed at the expected time. What am I missing?