Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <apex:page id="test" sideBar="false">
- <apex:includeLightning />
- <body class="slds-scope">
- <div id="omniDiv"></div>
- </body>
- <script type="text/javascript">
- (function() {
- window.addEventListener("internalapievent", function(evt) {console.log(evt);});
- // Script to inject Lightning component into the Visualforce page
- $Lightning.use("c:omniHelperApp", function() {
- $Lightning.createComponent("c:omniHelper", {}, "omniDiv", function(component) {
- console.debug(component.find("omniToolkitAPI"));
- });
- });
- }());
- </script>
- </apex:page>
- <aura:application access="GLOBAL" extends="ltng:outApp" description="omniHelperApp">
- <aura:dependency resource="c:omniHelper"/>
- </aura:application>
- <aura:component description="omniHelper" implements="flexipage:availableForAllPageTypes" access="global">
- <lightning:omniToolkitAPI aura:id="omniToolkitAPI" />
- <lightning:workspaceAPI aura:id="workspaceAPI" />
- <lightning:button label="Try stuff" onclick="{! c.tryStuff }" />
- </aura:component>
- ({
- tryStuff : function(component, event, helper) {
- console.log("omniHelper::doInit");
- var workspaceAPI = component.find("workspaceAPI");
- workspaceAPI.isConsoleNavigation().then(function(response) {
- console.log("omniHelper: "+response);
- }).catch(function(error) {
- console.log("omniHelper: "+error);
- });
- console.log("omniHelper::doInit done");
- }
- })
- omniHelper.js:11 omniHelper::doInit
- test:31 CustomEvent {isTrusted: false, detail: {…}, type: "internalapievent", target: Window, …}
- omniHelper.js:18 omniHelper::doInit done
Add Comment
Please, Sign In to add comment