I (finally) finished my lightning component to enable & disable a scheduled job for an AppExchange app I'll publish shortly.
I added it to a VF page and all the functionality worked with the exception of toasts, as documented in this response: Toast event in Lightning not working
As the toast isn't critical, I'm looking to either have conditional logic in the Lightning Component that only fires a toast if not in VF, or to suppress the error in the Visualforce / Lightning container (I'm not sure which one displays the error).
Thanks!
VF:
<apex:page controller="updateUsingLightningCheckboxController">
<apex:includeLightning />
<div id="lightning"/>
<script>
$Lightning.use("c:LightningAdoptionTrackerSetup", function() {
$Lightning.createComponent("c:LightninAdoptionTrackerSetup",
{ },
"lightning",
function(cmp) {
//do some stuff
});
});
</script>
</apex:page>
Example of the toast in my component's helper:
activateApp: function(cmp,evt) {
var action = cmp.get("c.startScheduler");
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
var toastEvent = $A.get("e.force:showToast");
cmp.set("v.isRunButtonDisabled", false);
toastEvent.setParams({
"message": response.getReturnValue(),
"type": "success",
"duration": 1500
});
toastEvent.fire();
}//if
});
$A.enqueueAction(action);
}