I have a ClojureScript component, where start
performs some async IO, obviously I can’t block the thread waiting for this to happen like I can on the JVM, so a component that depends on this one has no way to wait for start
to happen. Anyone know of any solutions to this? I could imagine an async extension to component
using promises or something like that, so that the start order/timing of start/stop is respected in a non-blocking environment.
@keeth I think the general approach would be to create asynchronous promise-like things and assoc
them into your components in their start
methods. Other components which need to start subsequently will have to use some kind of promise chaining.
Component was not designed with ClojureScript in mind, so it may not be an ideal solution.
@stuartsierra: thanks, yep that’s more-or-less what i have done, assoc
’d a ready?
key which returns a promise. thinking of maybe having these components implement an additional protocol with methods like started
and stopped
which return promises.