FIXME: rewrite to using promises, since closure is deprecating result
FIXME: rewrite to using promises, since closure is deprecating result
(chan method url)
(chan method url data)
(chan method url data {:keys [events upload body-only] :as options})
creates a channel and performs xhr request like (chan :GET "/something")
accepts url as string or [url params]
this channel will receive one message [status body req] on load loadend will close the result channel, so you will get nil results on request errors/timeouts
use options hash to pass in extra channels
(chan :POST "/something" some-data {:events chan-or-map :upload chan-or-map})
when given a chan that channels receives messages in form of [event-type event-data req] when given a map a channel is expected for each eventtype and will receive [event-data req] {:timeout some-chan}, if no channel for a given event is present, no message is sent
event types are :loadstart :progress :abort :error :timeout :loadend :load (see xhr spec) only exception is that status >= 500 does not return a result and produces an error event instead
creates a channel and performs xhr request like (chan :GET "/something") accepts url as string or [url params] this channel will receive one message [status body req] on load loadend will close the result channel, so you will get nil results on request errors/timeouts use options hash to pass in extra channels (chan :POST "/something" some-data {:events chan-or-map :upload chan-or-map}) when given a chan that channels receives messages in form of [event-type event-data req] when given a map a channel is expected for each eventtype and will receive [event-data req] {:timeout some-chan}, if no channel for a given event is present, no message is sent event types are :loadstart :progress :abort :error :timeout :loadend :load (see xhr spec) only exception is that status >= 500 does not return a result and produces an error event instead
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close