5

I want to write an LWC that listens for a small set of LMS messages, performs database operations sometimes and sometimes forwards new LMS messages for the benefit of another LWC that may or may not be present on the screen.

When I read about a "service" in the context of LWC it is usually an API that a component consumes. (I note that many components now use the suffix "api" for that.) What I am thinking of here a daemon component that can be inserted into a flex-page, but that has no UI. That component is doing its LMS listening and processing all the time in the background.

I haven't found an example of this yet, and don't want to create something that is going to cause pain in the future. But I would guess it is a common need? So if you use this pattern do share that in an answer here.

1 Answer 1

9

We have implemented something akin to this. However, it should be noted that:

  1. a UI-less LWC does actually consume a small amount of screen space in the rendered page which may mean you have to be careful just where you put it in the page.
  2. from the Lightning App Builder perspective it's a bit annoying because it's almost invisible (takes up almost no (vertical) space and renders nothing) so awkward for admins to find and update any attributes for.
1
  • Thanks for this and including the notes!
    – Keith C
    Commented Sep 21, 2021 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .