mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 19:42:32 -05:00
69851bc6cf
We can use DI for this, which makes it easier for plugins to subscribe to the message bus.
18 lines
456 B
JavaScript
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));
|
|
});
|
|
}
|
|
};
|