Guest User

Untitled

a guest
Feb 15th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <apex:page id="test" sideBar="false">
  2. <apex:includeLightning />
  3. <body class="slds-scope">
  4. <div id="omniDiv"></div>
  5. </body>
  6. <script type="text/javascript">
  7. (function() {
  8. window.addEventListener("internalapievent", function(evt) {console.log(evt);});
  9. // Script to inject Lightning component into the Visualforce page
  10. $Lightning.use("c:omniHelperApp", function() {
  11. $Lightning.createComponent("c:omniHelper", {}, "omniDiv", function(component) {
  12. console.debug(component.find("omniToolkitAPI"));
  13. });
  14. });
  15. }());
  16. </script>
  17. </apex:page>
  18.  
  19. <aura:application access="GLOBAL" extends="ltng:outApp" description="omniHelperApp">
  20. <aura:dependency resource="c:omniHelper"/>
  21. </aura:application>
  22.  
  23. <aura:component description="omniHelper" implements="flexipage:availableForAllPageTypes" access="global">
  24. <lightning:omniToolkitAPI aura:id="omniToolkitAPI" />
  25. <lightning:workspaceAPI aura:id="workspaceAPI" />
  26. <lightning:button label="Try stuff" onclick="{! c.tryStuff }" />
  27. </aura:component>
  28.  
  29. ({
  30. tryStuff : function(component, event, helper) {
  31. console.log("omniHelper::doInit");
  32. var workspaceAPI = component.find("workspaceAPI");
  33. workspaceAPI.isConsoleNavigation().then(function(response) {
  34. console.log("omniHelper: "+response);
  35. }).catch(function(error) {
  36. console.log("omniHelper: "+error);
  37. });
  38. console.log("omniHelper::doInit done");
  39. }
  40. })
  41.  
  42. omniHelper.js:11 omniHelper::doInit
  43. test:31 CustomEvent {isTrusted: false, detail: {…}, type: "internalapievent", target: Window, …}
  44. omniHelper.js:18 omniHelper::doInit done
Add Comment
Please, Sign In to add comment