potok.v2.core

Stream & Events based state management toolkit for ClojureScript.

data-event

(data-event t)(data-event t d)

Creates an event instance that only contains data.

deftype

macro

(deftype t fields & impls)

deftype

macro

(deftype t fields & impls)

effect?

(effect? e)

Return true when e satisfies the EffectEvent protocol.

EffectEvent

protocol

members

effect

(effect event state stream)

emit!

(emit! store event)(emit! store event & more)

Emits an event or a collection of them into the default store.

If you have instanciated your own store, this function provides 2-arity that allows specify a user defined store.

Event

protocol

members

-type

(-type _)

Returns the type of the event.

event

(event type)(event type params)

event?

(event? v)

Return true if v is an event.

handle-error

multimethod

input-stream

(input-stream store)

Returns the internal input stream of the store. Should be used by third party integration that want use store as event bus not only with defined events.

leaky-exists?

macro

(leaky-exists? x)

leaky-exists?

macro

(leaky-exists? x)

promise?

(promise? v)

Return true if v is a promise instance or is a thenable object.

reify

macro

(reify type & impls)

reify

macro

(reify type & impls)

repr-event

(repr-event event)

resolve

multimethod

store

(store)(store {:keys [on-error on-event state validate-fn], :or {on-error handle-error, validate-fn map?}, :as params})

Start a new store.

This function initializes a new event processing stream loop and returns a bi-directional rx stream that should be used to push new events and subscribe to state changes.

type

(type o)

type?

(type? t)(type? t v)

update?

(update? e)

Return true when e satisfies the UpdateEvent protocol.

UpdateEvent

protocol

members

update

(update event state)

Apply a transformation to the state.

watch?

(watch? e)

Return true when e satisfies the WatchEvent protocol.

WatchEvent

protocol

members

watch

(watch event state stream)