If you like, you can put an entire class inside the renderInOutlet
call:
import { apiInitializer } from "discourse/lib/api";
import Component from "@glimmer/component";
import { service } from "@ember/service";
export default apiInitializer((api) => {
api.renderInOutlet(
"composer-after-save-or-cancel",
class extends Component {
@service site;
<template>
{{#if this.site.mobileView}}
Mobile!
{{else}}
Normal!
{{/if}}
</template>
}
);
});
But the .lookup()
solution is also reasonable - that’s what @service
is doing behind-the-scenes anyway