Utility functions

Go ahead and create a new file under src/cljs/om_pm/ called util.cljs and add the following code:

(ns om-pm.util) 

(defn set-transfer-data! [e key value] (.setData (-> e .-nativeEvent .-dataTransfer) key value)) (defn get-transfer-data! [e key] (-> (-> e .-nativeEvent .-dataTransfer) (.getData key)))

These functions use JavaScript interoperability to interact with HTML's DataTransfer object[12]. This is how browsers share data related to drag and drop events.

The drag and drop events manipulate/mutate the cards. Next, we will see the parser.cljs file.