gumi icon indicating copy to clipboard operation
gumi copied to clipboard

onClose or onDismiss callback registration

Open ttacon opened this issue 10 years ago • 1 comments

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)?

ttacon avatar Nov 19 '14 17:11 ttacon

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(); }

b1lly avatar Nov 21 '14 18:11 b1lly