tiagobento commented on PR #2164:
URL:
https://github.com/apache/incubator-kie-tools/pull/2164#issuecomment-1964983122
@handreyrc I deleted my last comment because I think we need to make for
changes to this PR.
As you saw, there's already a Shared Value on `KogitoEditorChannelApi`. This
Shared Value is accessible on both ends -- Channel and Envelope. For this
reason, we don't need a new `kogitoEditor_setTheme` on
`KogitoEditorEnvelopeApi`. In fact, we don't even need to add the `theme`
property to the EditorInitArgs at all.
If you do a short-lived subscription of the shared value, you can read its
value asyncly.
```ts
const subscription =
envelopeServerApi.shared.kogitoEditor_theme.subscribe(newValue => {
doSomething(newValue);
envelopeServerApi.shared.kogitoEditor_theme.unsubscribe(subscription);
});
```
Of course, now looking at your use-case, it might've made sense to add an
`envelopeApi.shared.kogitoEditor_theme.get()`, returning a Promise with the
current value on the other side of the bus, like a `peek` on a stream.
---
Hope it made some sense, and yeah, really hard to know that given we have
zero documentation :/
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]