Open tomlarkworthy opened 2 years ago
https://github.com/observablehq/runtime/issues/286 might be related, specifically the promiseof
operator suggested there.
Oh yeah, if you use promiseof can we consume the events without retriggering, something like
frontend = {
while (true) {
await promiseof backend
}
}
If I did want to emit events while I am awaiting the promise I guess I can use .then in a more complex arrangement leaving space to get some yields in too (?).
Is your feature request related to a problem? Please describe. Some tasks have a async background aspect, for example, maintaining a login session require periodic refresh of a short lived access_token. The 'frontend' to components might have a dataflow with completely different dataflow schedule, for example, a login button might emit events only when the logged in user changes.
Now, I can hide a background processes dataflow updates using a bunch of viewofs or mutables that backwrite into the root component. With that approach I can control the events fully. The problem appears when I try to create a single importable cell of the login component. Background process side chains have to be additionally imported in addition to the button in order for them to manipulate the root component.
I cannot figure out a configuration that allows importing and creating an observed background process in a single cell.
I think the root cause is you can't put a dependency between cells without making the descendant reevaluate on the ascendant. There is a missing semantic.
Describe the solution you'd like Some extra macro like
which should make the name cell observed (i.e. run in runtime) but otherwise doesn't link the two cells with dataflow.
Describe alternatives you've considered Currently I make the importer just import the background worker too, but they have to instantiate it to e.g.