From da1e7b235285247e892d229888fad8f4c381ee8b Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Thu, 18 Sep 2014 09:21:55 +0000 Subject: [PATCH] Make the plugin works with invitations --- js/plugin.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/js/plugin.js b/js/plugin.js index 13855e1..c7507db 100644 --- a/js/plugin.js +++ b/js/plugin.js @@ -17,15 +17,24 @@ */ (function (Mibew) { + // Initialize separated Marionette.js module for the plugin. var module = Mibew.Application.module( - 'Chat.MibewEmojiPlugin', + 'MibewEmojiPlugin', {startWithParent: false} ); - // Start the module only after the parent one will be initialized. - Mibew.Application.Chat.on('start', function() { - module.start(); - }); + // Make the plugin works together with "Chat" and "Invitation" modules. + var eventsMap = { + 'start': function() { + module.start(); + }, + 'stop': function() { + module.stop(); + } + } + + Mibew.Application.Chat.on(eventsMap); + Mibew.Application.Invitation.on(eventsMap); module.addInitializer(function() { var imagesDir = Mibew.PluginOptions.MibewEmoji.imagesDir;