discourse/app/assets/javascripts/discourse/initializers/banner.js.es6
Robin Ward 69851bc6cf Deprecates global use of Discourse.MessageBus
We can use DI for this, which makes it easier for plugins to subscribe
to the message bus.
2015-03-12 12:27:30 -04:00

18 lines
456 B
JavaScript

export default {
name: "banner",
after: "message-bus",
initialize(container) {
const banner = Em.Object.create(PreloadStore.get("banner")),
site = container.lookup('site:main');
site.set("banner", banner);
const messageBus = container.lookup('message-bus:main');
if (!messageBus) { return; }
messageBus.subscribe("/site/banner", function (banner) {
site.set("banner", Em.Object.create(banner));
});
}
};