I'm trying to implement a dropzone such as this React Component. However, I'm a bit stuck on how to apply write effects on events, e.g.
dragOver$: DOM
.select('#dropzone')
.events('ondragover')
.map(e => {
e.preventDefault()
e.dataTransfer.dropEffect = 'copy'
})
Which won't work since there is no sink. The code inside map
should really be performed inside a sink.
Any suggestions?
You should write a simple driver that will handle this. See the docs on drivers here.
It seems like you could do something like this:
In short: drivers encapsulate all side effects and return inputs from those interfaces, and all side effects in Rx code is constrained to the
subscribe
argument Observers.