Skip to content

Commit

Permalink
feat: send custom event with code eval state payload
Browse files Browse the repository at this point in the history
  • Loading branch information
dviramontes committed Dec 3, 2017
1 parent fd1662a commit dd78e9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/klipse/klipse_editors.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
(swap! state update-in [:eval-counter] inc)
(let [evaluation-chan (eval-fn (str preamble src-code) @state)
first-result (<! evaluation-chan)]
(let [custom-event (js/CustomEvent. "klipse-snippet-evaled"
#js {:detail {:state (clj->js @state)
:src-code src-code}})]
(when-let [code-mirror-dom-node (js/document.querySelector ".klipse-container")]
(-> code-mirror-dom-node (.dispatchEvent custom-event))))
(setter first-result)
(when loop-msec
(go-loop []
Expand Down

0 comments on commit dd78e9e

Please sign in to comment.