gumi
gumi copied to clipboard
onClose or onDismiss callback registration
It might be awesome to have an explicit option to set a callback for when the user dismisses the dropdown (when they click somewhere else once it's already open)?
This seems like a great idea and is actually a simple implementation.
There's already functions to handle this exact behavior, all we need to do is add a hook to optionally trigger a registered function from the gumi settings object (that it was initialized with).
E.g.
$('.node').gumi({ onClose: function() {
} });
And within gumis internals, where the actual closing of dropdown logic happens, do something like:
if (typeof settings.onClose === 'function') { settings.onClose(); }