Module

Dexie.Promise

Package
purescript-dexie
Repository
mushishi78/purescript-dexie

#Promise Source

data Promise :: Type -> Type

Represents a thunk to create a Dexie Promise.

Ideally no async operations that are unrelated to indexed db should be modelled with these promises as they will automatically close an open transaction. So if you do not manually make a Promise, then the compiler can ensure you're not closing transactions.

See Transaction Scope for more details about closing transactions.

Documentation: dexie.org/docs/Promise/Promise Methods: Dexie.Promise

Instances

#LaunchedPromise Source

data LaunchedPromise :: Type -> Type

Represents a previously triggered Dexie Promise See Dexie.Promise

#new Source

new :: forall v. ((v -> Effect Unit) -> (Error -> Effect Unit) -> Effect Unit) -> Promise v

Equivalent of new Dexie.Promise((resolve, reject) => ...). Use with caution with non-indexed db related async operations if you do no want to close transactions early.

#all Source

all :: forall v. Array (Promise v) -> Promise (Array v)

Documentation: Promise.all()

#allSettled Source

allSettled :: forall v. Array (Promise v) -> Promise (Array v)

Documentation: Promise.allSettled()

#any Source

any :: forall v. Array (Promise v) -> Promise (Array v)

Documentation: Promise.any()

#catch Source

catch :: forall v. (Error -> Promise v) -> Promise v -> Promise v

Documentation: Promise.prototype.catch()

#finally Source

finally :: forall v. Effect Unit -> Promise v -> Promise v

Documentation: Promise.prototype.finally()

#race Source

race :: forall v. Array (Promise v) -> Promise v

Documentation: Promise.race()

#reject Source

reject :: forall v. Error -> Promise v

Documentation: Promise.reject()

#resolve Source

resolve :: forall v. v -> Promise v

Documentation: Promise.resolve()

#_then Source

_then :: forall v1 v2. (v1 -> Promise v2) -> Promise v1 -> Promise v2

Documentation: Promise.prototype.then()

#launch Source

launch :: forall v me. MonadEffect me => Promise v -> me (LaunchedPromise v)

Triggers a promise but does not wait for it to resolve.

#join Source

join :: forall v. LaunchedPromise v -> Promise v

Can be used to wait on a previously triggered promise.

#toAff Source

toAff :: forall a ma. MonadAff ma => Promise a -> ma a