Created
January 9, 2017 22:26
-
-
Save joebuschmann/7a2d15146aae92ee290aed4bb1fe3f52 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