Liking cljdoc? Tell your friends :D

cljs-async.cljs.core

cljs

Promises and futures largely compatible with the clojure.core api.

The main difference is, that [[cljs.core/deref]]/@ cannot be used on promises and futures. Instead async-deref can be used to work with the respective results asynchronously. Also, futures may do asynchronous operations, by returning a core/promise.

Note that [[cljs.core/realized?]] works on both promises and futures.

Promises and futures largely compatible with the clojure.core api.

The main difference is, that [[cljs.core/deref]]/`@` cannot be used
on promises and futures. Instead [[async-deref]] can be used to work
with the respective results asynchronously. Also, futures may do
asynchronous operations, by returning a [[core/promise]].

Note that [[cljs.core/realized?]] works on both promises and futures.
raw docstring

async-derefcljs

(async-deref v)
(async-deref v timeout-ms timeout-val)

Returns a js/Promise of the result of the given promise or future, optionally with a timeout.

Returns a js/Promise of the result of the given promise or future, optionally with a timeout.
sourceraw docstring

delivercljs

(deliver p v)

Delivers the supplied value to the promise, releasing any pending derefs. A subsequent call to deliver on a promise will have no effect.

Delivers the supplied value to the promise, releasing any pending
derefs. A subsequent call to deliver on a promise will have no
effect.
sourceraw docstring

futurecljmacro

(future & body)

Takes a body of expressions and yields a future object that will evaluate the body later, and will cache the result and return it on all subsequent calls to async-deref.

Takes a body of expressions and yields a future object that will
evaluate the body later, and will cache the result and return it on
all subsequent calls to [[async-deref]].
sourceraw docstring

future-callcljs

(future-call thunk)

Takes a function of no args and yields a future object that will invoke the function later, and will cache the result and return it on all subsequent calls to async-deref.

Takes a function of no args and yields a future object that will
invoke the function later, and will cache the result and return it on
all subsequent calls to [[async-deref]].
sourceraw docstring

future-cancelcljs

(future-cancel f)

Cancels the future, if possible.

Cancels the future, if possible.
sourceraw docstring

future-cancelled?cljs

(future-cancelled? f)

Returns true if the given future is cancelled.

Returns true if the given future is cancelled.
sourceraw docstring

future-done?cljs

(future-done? f)

Returns true if the given future is done.

Returns true if the given future is done.
sourceraw docstring

future?cljs

(future? v)

Returns true if v is a future.

Returns true if `v` is a future.
sourceraw docstring

IAsyncDerefcljsprotocol

-async-derefcljs

(-async-deref this)

Returns a js/Promise resolving to the value of this once it is available.

Returns a js/Promise resolving to the value of
this once it is available.
source

IAsyncDerefWithTimeoutcljsprotocol

-async-deref-with-timeoutcljs

(-async-deref-with-timeout this msec timeout-val)

Returns a js/Promise resolving to the value of this once it is available, or to the given value after a timeout of the given number of milliseconds.

Returns a
js/Promise resolving to the value of this once it is available, or
to the given value after a timeout of the given number of
milliseconds.
source

promisecljs

(promise)

Returns a promise object that can be read with async-deref, and set, once only, with deliver.

Returns a promise object that can be read with [[async-deref]], and set,
once only, with [[deliver]]. 
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close