promesa.protocols

A generic promise abstraction and related protocols.

IAwaitable

protocol

members

-await!

(-await! it)(-await! it duration)

block current thread await termination

IBuffer

protocol

members

-full?

(-full? it)

-offer!

(-offer! it val)

-poll!

(-poll! it)

-size

(-size it)

ICancellable

protocol

A cancellation abstraction.

members

-cancel!

(-cancel! it)

-cancelled?

(-cancelled? it)

IChannelInternal

protocol

members

-cleanup!

(-cleanup! it)

IChannelMultiplexer

protocol

members

-tap!

(-tap! it ch close?)

-untap!

(-untap! it ch)

ICloseable

protocol

members

-close!

(-close! it)(-close! it reason)

-closed?

(-closed? it)

ICompletable

protocol

members

-reject!

(-reject! it e)

Deliver an error to empty promise.

-resolve!

(-resolve! it v)

Deliver a value to empty promise.

IExecutor

protocol

members

-exec!

(-exec! it task)

Submit a task and return nil

-run!

(-run! it task)

Submit a task and return a promise.

-submit!

(-submit! it task)

Submit a task and return a promise.

IHandler

protocol

members

-active?

(-active? it)

-blockable?

(-blockable? it)

-commit!

(-commit! it)

ILock

protocol

An experimental lock protocol, used internally; no public api

members

-lock!

(-lock! it)

-unlock!

(-unlock! it)

IPromise

protocol

members

-fmap

(-fmap it f)(-fmap it f executor)

Apply function to a computation

-fnly

(-fnly it f)(-fnly it f executor)

Apply function to a computation independently if is failed or successful; the return value is ignored.

-hmap

(-hmap it f)(-hmap it f executor)

Apply function to a computation independently if is failed or successful.

-mcat

(-mcat it f)(-mcat it f executor)

Apply function to a computation and flatten 1 level

-merr

(-merr it f)(-merr it f executor)

Apply function to a failed computation and flatten 1 level

-then

(-then it f)(-then it f executor)

Apply function to a computation and flatten multiple levels

IPromiseFactory

protocol

A promise constructor abstraction.

members

-promise

(-promise it)

Create a promise instance from other types

IReadChannel

protocol

members

-take!

(-take! it handler)

IScheduler

protocol

A generic abstraction for scheduler facilities.

members

-schedule!

(-schedule! it ms func)

Schedule a function to be executed in future.

ISemaphore

protocol

An experimental semaphore protocol, used internally; no public api

members

-acquire!

(-acquire! it)(-acquire! it n)

Acquire 1 or N permits

-release!

(-release! it)(-release! it n)

Release 1 or N permits

-try-acquire!

(-try-acquire! it)(-try-acquire! it n)(-try-acquire! it n t)

Try acquire n or n permits, non-blocking or optional timeout

IState

protocol

Additional state/introspection abstraction.

members

-extract

(-extract it)(-extract it default)

Extract the current value.

-pending?

(-pending? it)

Retutns true if a promise is pending.

-rejected?

(-rejected? it)

Returns true if a promise is rejected.

-resolved?

(-resolved? it)

Returns true if a promise is resolved.

IWriteChannel

protocol

members

-put!

(-put! it val handler)