std.lib.component

*kill*

dynamic

all-props

added in 3.0

(all-props component)

lists all props in the component

(all-props (Database.)) => :interval

component?

added in 3.0

(component? obj)

checks if an instance extends IComponent

(component? (Database.)) => true

get-options

added in 3.0

(get-options component opts)

helper function for start and stop

(get-options (Database.) {:init (fn x 1)}) => (contains {:init fn?})

get-prop

added in 3.0

(get-prop component k)

gets a prop in the component

(get-prop (Database.) :interval) => 10

health

added in 3.0

(health component)

returns the health of the component

(health (Database.)) => {:status :ok}

impl:component

added in 3.0

(impl:component {:keys [name]})

rewrite function compatible with std.lib.impl

info

added in 3.0

(info component)(info component level)

returns info regarding the component

(info (Database.)) => {:info true}

kill

added in 3.0

(kill component)(kill component opts)

kills a systems, or if method is not defined stops it

(kill (start (Database.))) => {}

perform-hooks

added in 3.0

(perform-hooks component functions hook-ks)

perform hooks before main function

(perform-hooks (Database.) {:init (fn x 1)} :init) => 1

primitive?

added in 3.0

(primitive? x)

checks if a component is a primitive type

(primitive? 1) => true

(primitive? {}) => false

remote?

added in 3.0

(remote? component)

returns whether the component connects remotely

(remote? (Database.)) => false

set-prop

added in 3.0

(set-prop component k value)

sets a prop in the component

(set-prop (Database.) :interval 3) => (throws)

start

added in 3.0

(start component)(start component opts)

starts a component/array/system

(start (Database.)) => {:status “started”}

started?

added in 3.0

(started? component)

checks if a component has been started

(started? 1) => true

(started? (start {})) => true

(started? (Database.)) => true

stop

added in 3.0

(stop component)(stop component opts)

stops a component/array/system

(stop (start (Database.))) => {}

stop-raw

added in 3.0

(stop-raw component)

switch between stop and kill methods

stopped?

added in 3.0

(stopped? component)

checks if a component has been stopped

(stopped? 1) => false

(stopped? {}) => false

(stopped? (start {})) => false

(stopped? (Database.)) => false

with

macro

added in 3.0

(with [var expr & more] & body)

do tests with an active component

(with db (Database.) (started? db)) => true

with-lifecycle

macro

(with-lifecycle [var {:keys [start stop]} & more] & body)

wrap-start

added in 4.0

(wrap-start f steps)

wraps the start function with more steps

wrap-stop

added in 4.0

(wrap-stop f steps)

wraps the stop function with more steps