Attaching an Event Handler

I have an event handler called some-handler and an event called someevent, the following works when doing this in javascript,

window.onsomeevent = space.some_handler; 

I have been working in search engines for almost an hour, but cannot find how to do this in clojurescript?

+4
source share
1 answer

Here is a snippet to add a listener to the window. Look at other types of google close events: http://closure-library.googlecode.com/svn/docs/closure_goog_events_eventtype.js.source.html

 (ns example (:require [goog.dom :as dom] [goog.events :as events])) (def w (dom/getWindow)) (events/listen w (.-MOUSEDOWN events/EventType) #(js/alert "Handle Mouse Down")) 
+4
source

Source: https://habr.com/ru/post/1379658/


All Articles