hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
2018-01-13T04:18:04.000071Z

@flyboarder well to get a useful "dragleave" event using the dnd api you need to count dragenter/dragleave events because they trigger on some nested elements too

2018-01-13T04:18:33.000010Z

so i end up with something like

2018-01-13T04:18:36.000033Z

:dragenter (fn [e]
               (wheel.dom.events/prevent-default e)
               (swap! drag-enters update (-> e .-originalEvent .-target) inc))
   :dragleave (fn [e]
               (wheel.dom.events/prevent-default e)
               ; use a RAF to ensure leave is always called after enter but
               ; avoid the UI jank that a regular timeout would incur
               (.requestAnimationFrame js/window
                #(swap! drag-enters update (-> e .-originalEvent .-target) dec)))

2018-01-13T04:19:22.000102Z

which really seems like something i should bundle up for re-use

2018-01-13T04:20:41.000062Z

so i was assuming that i'd need to namespace the :dragenter and :dragleave attributes and put them in a fn that applies them to a passed element - namespacing would be to ensure that the element can have other things bound to the same events

2018-01-13T04:21:08.000062Z

although, i haven't tested it yet, it might already work as event handling and attributes are different things

flyboarder 2018-01-13T18:48:10.000022Z

@thedavidmeister so for that I would just namespace it