Skip to content

add an example with remoteWidget / how to "get data out of a never ending widget" ? #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
srghma opened this issue Jan 30, 2021 · 2 comments

Comments

@srghma
Copy link

srghma commented Jan 30, 2021

in documentation

https://ajnsit.github.io/concur-documentation/ch03-03-composing-never-ending-widgets.html

As the previous section showed, it's recommended to avoid creating widgets which never end, to allow arbitrary composition. However, at this point it must be pointed out that Concur does allow you to compose never-ending widgets in meaningful ways, as long as you remember that a never ending-widget will only be a Consumer, and not a Producer of meaningful data. (PS: There are ways to get data out of a never ending widget as well. See remoteWidget for an example).

could we add this ways to get data out of a never ending widget as well as an example?

I dont understand how remoteWidget / forkAction / forkActionWithState functions work

related to #55

@srghma srghma changed the title add an example with removeWidget / how to "get data out of a never ending widget" ? add an example with remoteWidget / how to "get data out of a never ending widget" ? Jan 30, 2021
@srghma
Copy link
Author

srghma commented Jan 30, 2021

what the signature means

remoteWidget ::
  forall m n a void.
  MonadEffect n =>
  MonadAff m =>
  MonadEffect m =>
  Plus m =>
  m a ->
  n (Tuple (m a) (m void))

what is m a?

what is m void?

@ajnsit
Copy link
Member

ajnsit commented Feb 9, 2021

A remote widget essentially splits a widget into two parts, a consumer of user events (m void) and a producer of UI updates (m a) that stay remotely connected. You would use it to keep the listeners alive while being able to remove the widget from the UI or returning a result from the widget.

I need to write more documentation on these, but the function is short enough for the source to be read. The reason I haven't spent a lot of time writing more documentation for them is that they never felt very satisfactory to me, and I have been looking for better solutions.

@ajnsit ajnsit closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants