Documentation about JetBrains/rd (LifetimeDefinition, IPropertyView, etc)

Answered

Hi,

I noticed some plugin using `rd` (Reactive Distributed) types. However I wasn't able to find any proper documentation. From what I think I understood from the project some of the Kotlin types are generated from C#, right ?

https://github.com/JetBrains/rd

While I can somewhat navigate this repository, it would be awesome if there was some kind of document explaining how to use, and documenting misuse.

Thank you in advance

 

0
5 comments

We currently do not have high-level documentation available.

Please see https://github.com/JetBrains/rd/issues/206

What do you want to use? And where?

0

Yann Cebron I am developing a plugin with the CEF view, this plugin needs to communicate via messages to the javascript app that runs in the JCEF window.

Currently I have something that works using `IPropertyView.advise(lifetime)`, and simply `IProperty.set`. I understand and see it in action that the advise handler is called when the set method is called

Yet I noticed IJ proposes different obscure variation of the `advise` methods (Until, eternal, WithPrev, etc). There is also I noticed the `view` method. Outside what I can find in the source repository. I'd like to confirm what these do or implies.

 

Currently I would like block the code until a value has been set to a correct value.

dipose() {
sendMessageToCef()
// js app receives the message and send back something via cefQuery
// Cef message router handler get the message from the JS app, sets value in IProperty
propView.xxxxx { v -> v == "something" } // <= blocks
// proceed to other cleanup and termination only after propView has been set.
}

From what I have seen it seems `adviseUntil` is appropriate.

 

 

0

Actually no, `adviseUntil` is not what I'm looking for.

 

There are also other interesting methods like `debounce`, I understand their meaning, but understanding their implication in regard of the rd library could be useful.

0

Unfortunately, there're no tools for blocking wait for property value. You might want to try using Kotlin Coroutines/kotlinx.coroutines.CompletableDeferred. Or "plain" JCEF/JS https://plugins.jetbrains.com/docs/intellij/jcef.html

0

Actually I found what I was looking for via IntelliJ's `org.jetbrains.concurrency` package, as it gives me more flexibility on blocking or using promises. In particular :

org.jetbrains.concurrency.AsyncPromise
0

Please sign in to leave a comment.