Guest User

Untitled

a guest
Jul 16th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
  2. <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  3.  
  4. <div>This component checks static resource loading on Init</div>
  5. {!v.body}
  6. </aura:component>
  7.  
  8. ({
  9. doInit : function(cmp, event, helper) {
  10. $A.createComponent(
  11. "ltng:require",
  12. {
  13. "scripts": "/community/resource/loadMe.js"
  14.  
  15. },
  16. function(newButton, status, errorMessage){
  17. //Add the new button to the body array
  18. if (status === "SUCCESS") {
  19. var body = cmp.get("v.body");
  20. body.push(newButton);
  21. cmp.set("v.body", body);
  22. }
  23. else if (status === "INCOMPLETE") {
  24. console.log("No response from server or client is offline.")
  25. // Show offline error
  26. }
  27. else if (status === "ERROR") {
  28. console.log("Error: " + errorMessage);
  29. // Show error message
  30. }
  31. }
  32. );
  33. }
  34. }
  35. })
  36.  
  37. <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
  38. <ltng:require scripts="{!$Resource.loadMe}"/>
  39.  
  40. <div>This component checks static resource loading on Init</div>
  41.  
  42. {!v.body}
  43. </aura:component>
  44.  
  45. $A.createComponent(
  46. "ltng:require",
  47. {
  48. "scripts": $A.get("$Resource.loadMe")
  49. },
Add Comment
Please, Sign In to add comment