-
-
Save jstvz/21764e2565463fba265e635297b59c7d to your computer and use it in GitHub Desktop.
force:showToast event handler in a VF page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var postEventToOneApp = function(name, params, fallbackAction) { | |
if (SfdcApp && SfdcApp.projectOneNavigator && SfdcApp.projectOneNavigator.fireContainerEvent) { | |
// Not officially supported by Salesforce | |
SfdcApp.projectOneNavigator.fireContainerEvent(name, params); | |
} else if (fallbackAction) { | |
// Fallback if no Salesforce support of fireContainerEvent | |
fallbackAction(); | |
} | |
}; | |
$A.eventService.addHandler({ | |
event: 'force:showToast', | |
handler: function(event) { | |
postEventToOneApp('force:showToast', event.$params$, function() { | |
alert(event.$params$.message); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment