diff --git a/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js b/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js --- a/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js +++ b/rhodecode/public/js/src/components/rhodecode-app/rhodecode-app.js @@ -16,9 +16,25 @@ var rhodeCodeApp = Polymer({ for (var i = 0; i < alertMessagePayloads.length; i++) { $.Topic('/notifications').publish(alertMessagePayloads[i]); } - this.kickoffChannelstreamPlugin(); + this.initPlugins(); + // after rest of application loads and topics get fired, launch connection + $(document).ready(function () { + this.kickoffChannelstreamPlugin(); + }.bind(this)); }, + initPlugins: function(){ + for (var i = 0; i < window.APPLICATION_PLUGINS.length; i++) { + var pluginDef = window.APPLICATION_PLUGINS[i]; + if (pluginDef.component){ + var pluginElem = document.createElement(pluginDef.component); + this.shadowRoot.appendChild(pluginElem); + if (typeof pluginElem.init !== 'undefined'){ + pluginElem.init(); + } + } + } + }, /** proxy to channelstream connection */ getChannelStreamConnection: function () { return this.$['channelstream-connection']; diff --git a/rhodecode/templates/base/root.mako b/rhodecode/templates/base/root.mako --- a/rhodecode/templates/base/root.mako +++ b/rhodecode/templates/base/root.mako @@ -70,6 +70,7 @@ c.template_context['default_user'] = { var templateContext = ${h.json.dumps(c.template_context)|n}; var APPLICATION_URL = "${h.route_path('home').rstrip('/')}"; + var APPLICATION_PLUGINS = []; var ASSET_URL = "${h.asset('')}"; var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}"; var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";