FIXME: rewrite to using promises, since closure is deprecating result
FIXME: rewrite to using promises, since closure is deprecating result
(as-url input)
(auto-transform req)
(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
(e->data e)
(event-handler req events event-type)
(make-request-options options)
(make-url url params)
(register-transform content-type transform-fn)
(request method url)
(request method url data)
(request method url data options)
(request-error? status)
(request-ok? status)
(result-chain res handler)
(result-combine & results)
(result-error res callback)
(result-immediate value)
(result-success? res)
(result-value res)
(result-wait-on-success res callback)
(transform-request-body data)
(upload url file & events)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close