0
votes

I import one js library from node_modules in clojurescript and create an object provider using it. Now I need to subscribe on events of this object. This is javascript code:

provider.on("disconnect", (error: { code: number; message: string }) => {
  console.log(error);
});

How can I do the same in clojurescript? I tried this:

(.on provider "disconnect" #(js/console.log "disconnected"))

and this:

(.on provider #js {:event "disconnect"} #(js/console.log "disconnected"))

but it does not work.

1
the first one looks about right, but what does not work? How does it fail? - cfrick
Just no reaction on event. - Liza

1 Answers

-1
votes

The first one is right, it works, I had the problem, because the event didn't arise.