needim / wdt-emoji-bundle

Slack like emoji picker with apple/ios, twitter/twemoji, google, emojione, facebook, messenger emoji support
http://ned.im/wdt-emoji-bundle
MIT License
419 stars 87 forks source link

Is there an off() functionionality? #35

Open ManuZenou opened 6 years ago

ManuZenou commented 6 years ago

Im user 'on' to bind select event.

wdtEmojiBundle.on('select', function (event) {
    XXXXXXXX
});

can do I unbind it? is there an off() function?

Thanks.

ManuZenou commented 6 years ago

is there a way to 'destroy' the emoji picker?

needim commented 6 years ago

Hımm good point. Currently, we don't have that functionality.

Vuurvlieg commented 6 years ago

I need this functionality so when it would be added?

ktrzeciaknubisa commented 2 years ago

You can write your own simple function and place it anywhere in the code. e.g.:

    wdtEmojiBundle.off = function (eventName, handler) {
        switch (eventName) {
            case "select":
                return wdtEmojiBundle.dispatchHandlers.select = [];
                break;
            case "afterSelect":
                return wdtEmojiBundle.dispatchHandlers.afterSelect = [];
                break;
            case "afterPickerOpen":
                return wdtEmojiBundle.dispatchHandlers.afterPickerOpen = [];
                break;
            default:
                console.error('wdt-emoji-bundle - Not supported event type!', eventName);
                break;
        }
    };

and just call it like:

 wdtEmojiBundle.off('afterSelect')

The function is a modified version of wdtEmojiBundle.on()