Liking cljdoc? Tell your friends :D

prpr.a-frame.interceptor-chain


assoc-opaque-keysclj/s

(assoc-opaque-keys ctx app-ctx a-frame-router)

add the opaque keys to the interceptor context

they are removed from reported contexts by sanitise-context

add the opaque keys to the interceptor context

they are removed from reported contexts by `sanitise-context`
sourceraw docstring

clear-errorsclj/s

(clear-errors context)

Removes any associated ::errors from context

Removes any associated `::errors` from `context`
sourceraw docstring

context-keysclj/s

The Interceptor specific keys that are added to contexts

The Interceptor specific keys that are added to contexts
sourceraw docstring

default-error-handlerclj/s

(default-error-handler e)
source

default-suppressed-error-handlerclj/s

(default-suppressed-error-handler errors)
source

dissoc-context-keysclj/s

(dissoc-context-keys context)

Removes all interceptor related keys from context

Removes all interceptor related keys from `context`
sourceraw docstring

enqueueclj/s

(enqueue context interceptors)

Adds interceptors to the end of the interceptor queue within context

Adds `interceptors` to the end of the interceptor queue within `context`
sourceraw docstring

enter-allclj/s

(enter-all context)

Process the :queue of context, calling each :enter fn in turn.

If an error is raised it is captured, stored in the contexts :error key, and the queue is cleared (to prevent further processing.)

Process the `:queue` of `context`, calling each `:enter` `fn` in turn.

If an error is raised it is captured, stored in the `context`s `:error` key,
and the queue is cleared (to prevent further processing.)
sourceraw docstring

enter-nextclj/s

(enter-next {queue :prpr.a-frame.interceptor-chain/queue
             stack :prpr.a-frame.interceptor-chain/stack
             _history :prpr.a-frame.interceptor-chain/history
             :as context})

Executes the next ::enter interceptor queued within context, returning a promise that will resolve to the next pr-loop-context action to take

Executes the next `::enter` interceptor queued within `context`, returning a
promise that will resolve to the next [[pr-loop-context]] action to take
sourceraw docstring

executeclj/s

(execute app-ctx a-frame-router interceptor-chain initial-context)

Returns a Promise encapsulating the execution of the given InterceptorContext.

Runs all :enter interceptor fns (in FIFO order) and then all :leave fns (in LIFO order) returning the end result context map.

If an error occurs during execution :enter processing is terminated and the :error handlers of all executed interceptors are called (in LIFO order), with the original error wrapped in an ex-info with ex-data containing the ::context at the point of failure - this can be used to resume processing from the failure point

If the resulting context still contains an error after this processing it will be re-thrown when the execution promise is realised.

Returns a Promise encapsulating the execution of the given [[InterceptorContext]].

Runs all `:enter` interceptor fns (in FIFO order) and then all `:leave` fns
(in LIFO order) returning the end result `context` map.

If an error occurs during execution `:enter` processing is terminated and the
`:error` handlers of all executed interceptors are called (in LIFO order),
with the original error wrapped in an ex-info with ex-data containing the
::context at the point of failure - this can be used to resume processing
from the failure point

If the resulting `context` _still_ contains an error after this processing it
will be re-thrown when the execution promise is realised. 
sourceraw docstring

execute*clj/s

(execute* context)
(execute* error-handler suppressed-error-handler context)
source

initiateclj/s

(initiate app-ctx a-frame-router interceptor-chain initial-context)

Given a sequence of InterceptorSpecs and a map of initial-context values, returns a new InterceptorContext ready to execute

Given a sequence of [[InterceptorSpec]]s and a map of `initial-context` values,
returns a new [[InterceptorContext]] ready to [[execute]]
sourceraw docstring

Interceptorclj/s

An Interceptor, all methods are optional but should be implemented as follows:

  • ::enter takes 1 or 2 args:

    • context -> context
    • context -> data -> context
  • ::leave – takes 1 or 2 args:

    • context -> context
    • context -> data -> context
  • ::error – takes two args

    • context -> error -> context

All methods may return either promises or plain values.

An Interceptor, all methods are optional but should be implemented as
follows:

* `::enter` takes 1 or 2 args:
   - context -> context
   - context -> data -> context

* `::leave` – takes 1 or 2 args:
   - context -> context
   - context -> data -> context

* `::error` – takes two args
   - context -> error -> context

All methods may return either promises or plain values.
sourceraw docstring

interceptor-data-keyclj/s

(interceptor-data-key interceptor-fn-key)
source

interceptor-fn-history-thunkclj/s

(interceptor-fn-history-thunk interceptor-fn-key interceptor-spec context error)

returns a [<history-entry> <interceptor-fn-thunk>]

returns a [<history-entry> <interceptor-fn-thunk>]
sourceraw docstring

interceptor-fn-keysclj/s

source

interceptor-fn-noopclj/s

source

InterceptorContextclj/s

source

InterceptorFnHistoryKeyclj/s

source

InterceptorFnKeyclj/s

source

InterceptorHistoryElemclj/s

source

InterceptorListclj/s

source

InterceptorSpecclj/s

the interceptor chain is created with a list of InterceptorSpecs. each InterceptorSpec is either

  • simple keyword, referencing a registered interceptor which will cause ::enter and ::leave fns to be invoked with 1-arity, or
  • a pair of [interceptor-kw interceptor-data]. if there is data (either ::enter-data or ::leave-data) then ::enter and ::leave will be invoked with their 2-arity

providing data like this allows a pure-data (in the re-frame sense - roughly something which has no opaque objects and is serializable/deserializable) interceptor chain to be registered, which has numerous benefits

the interceptor chain is created with a list of InterceptorSpecs. each
InterceptorSpec is either
-  simple keyword, referencing a registered interceptor which will cause
   ::enter and ::leave fns to be invoked with 1-arity, or
- a pair of [interceptor-kw interceptor-data]. if there is data
   (either ::enter-data or ::leave-data) then ::enter and ::leave will
   be invoked with their 2-arity

providing data like this allows a pure-data (in the re-frame sense - roughly
something which has no opaque objects and is serializable/deserializable)
interceptor chain to be registered, which has numerous benefits
sourceraw docstring

leave-allclj/s

(leave-all context)

Process the ::stack of context, calling, in LIFO order.

If an ::error is present in the context then the ::error handling fn of the interceptors will be called otherwise the :leave fns will be called.

Any thrown errors will replace the current ::error with stack unwinding continuing from that point forwards.

Process the `::stack` of `context`, calling, in LIFO order.

If an `::error` is present in the `context` then the `::error` handling `fn`
of the interceptors will be called otherwise the `:leave` `fn`s will be
called.

Any thrown errors will replace the current `::error` with stack unwinding
continuing from that point forwards.
sourceraw docstring

leave-nextclj/s

(leave-next {stack :prpr.a-frame.interceptor-chain/stack
             _history :prpr.a-frame.interceptor-chain/history
             [error :as _errors] :prpr.a-frame.interceptor-chain/errors
             :as context})

Executes the next ::leave or ::error interceptor on the stack within context, returning a promise that will resolve to the next pr-loop-context action to take

Executes the next `::leave` or `::error` interceptor on the stack within
`context`, returning a promise that will resolve to the next
[[pr-loop-context]] action to take
sourceraw docstring

maybe-execute-interceptor-fnclj/s

(maybe-execute-interceptor-fn interceptor-fn-key interceptor-spec context error)

call an interceptor fn on an interceptor, resolving any supplied data

call an interceptor fn on an interceptor, resolving
any supplied data
sourceraw docstring

maybe-execute-interceptor-fn-thunkclj/s

(maybe-execute-interceptor-fn-thunk thunk context)
source

normalize-interceptor-specclj/s

(normalize-interceptor-spec interceptor-spec)

turns keyword interceptor-specs into maps {::key <interceptor-key>}

turns keyword interceptor-specs into maps
{::key <interceptor-key>}
sourceraw docstring

opaque-context-keysclj/s

keys which contain opaque data

keys which contain opaque data
sourceraw docstring

pr-loop-contextclj/s

(pr-loop-context context step-fn)
source

pr-loop-context*clj/s

(pr-loop-context* context step-fn)

Helper fn to repeat execution of step-fn against context inside a promise loop.

step-fn should return a tuple of either [::break <value>] or [::recur <new context>]. The former will terminate the loop and return <value>, the later will pass <new context> to the next loop iteration.

(Note: this mainly exists to abstract away and minimise the platform specific aspects of handling promise loops.)

Helper fn to repeat execution of `step-fn` against `context` inside a promise
loop.

`step-fn` should return a tuple of either `[::break <value>]` or `[::recur
<new context>]`. The former will terminate the loop and return `<value>`, the
later will pass `<new context>` to the next loop iteration.

(Note: this mainly exists to abstract away and minimise the platform specific
aspects of handling promise loops.)
sourceraw docstring

register-interceptorclj/s

(register-interceptor interceptor-key interceptor)
source

resolve-interceptorclj/s

(resolve-interceptor interceptor-key)
source

resolve-interceptor-dataclj/s

(resolve-interceptor-data interceptor-fn-key interceptor-data-specs context)

resolve the interceptor data, returning either

  • [data-val] if there was data specified
  • nil if no data was specified
resolve the interceptor data, returning either
- [data-val] if there was data specified
- nil if no data was specified
sourceraw docstring

resumeclj/s

(resume app-ctx a-frame-router err-or-resume-context)
(resume app-ctx
        a-frame-router
        error-handler
        suppressed-error-handler
        err-or-resume-context)

resume a failed interceptor chain, from either a thrown exception or a logged resume-context

resume a failed interceptor chain, from either
a thrown exception or a logged resume-context
sourceraw docstring

sanitise-contextclj/s

(sanitise-context context)

remove impure / opaque data from a context

remove impure / opaque data from a context
sourceraw docstring

terminateclj/s

(terminate context)

Removes all queued interceptors from context

Removes all queued interceptors from `context`
sourceraw docstring

unwrap-original-errorclj/s

(unwrap-original-error e)

unwrap layers of error wrapping (in case of nested :dispatch) to get at the causal exception

unwrap layers of error wrapping (in case of nested :dispatch)
to get at the causal exception
sourceraw docstring

wrap-errorclj/s

(wrap-error resume-context e)
source

wrap-interceptor-errorclj/s

(wrap-interceptor-error resume-context new-context e)

wrap an exception and add to the interceptor errors

wrap an exception and add to the interceptor errors
sourceraw docstring

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

× close