Liking cljdoc? Tell your friends :D

wagoe.audience.shell.registry

Load-time registry of audience segment definitions and the defaudience macro.

The registry is mutable process state, so it lives in the shell — the audience core namespaces (compiler, composition, filter, ui) stay pure. Definitions are registered at namespace load via the defaudience macro (validated against the AudienceDefinition schema) and read at runtime by the audience service.

Load-time registry of audience segment definitions and the `defaudience` macro.

The registry is mutable process state, so it lives in the shell — the audience
core namespaces (compiler, composition, filter, ui) stay pure. Definitions are
registered at namespace load via the `defaudience` macro (validated against the
AudienceDefinition schema) and read at runtime by the audience service.
raw docstring

clear-registry!clj

(clear-registry!)

Remove all registered audience definitions. Primarily used in tests to reset state between test runs.

Returns: empty map

Remove all registered audience definitions.
Primarily used in tests to reset state between test runs.

Returns:
  empty map
sourceraw docstring

defaudiencecljmacro

(defaudience sym definition-map)

Define an audience segment and register it in the in-process registry.

Creates a Var named sym bound to definition-map and registers it so it can be looked up by its :id at runtime.

Example: (defaudience free-users {:id :free-users :label "Free plan users" :filters [{:type :plan :field :plan :op :eq :value "free"}]})

The defined audience is immediately accessible via get-audience.

Define an audience segment and register it in the in-process registry.

Creates a Var named `sym` bound to `definition-map` and registers it
so it can be looked up by its :id at runtime.

Example:
  (defaudience free-users
    {:id      :free-users
     :label   "Free plan users"
     :filters [{:type :plan :field :plan :op :eq :value "free"}]})

The defined audience is immediately accessible via get-audience.
sourceraw docstring

get-audienceclj

(get-audience id)

Retrieve a registered audience definition by id.

Args: id - keyword

Returns: AudienceDefinition map, or nil if not registered

Retrieve a registered audience definition by id.

Args:
  id - keyword

Returns:
  AudienceDefinition map, or nil if not registered
sourceraw docstring

list-audiencesclj

(list-audiences)

Return the ids of all registered audience definitions.

Returns: Sequence of keywords

Return the ids of all registered audience definitions.

Returns:
  Sequence of keywords
sourceraw docstring

register-audience!clj

(register-audience! definition)

Register an audience definition in the in-process registry.

Validates the definition against AudienceDefinition schema before registration. Throws ex-info on invalid input.

Args: definition - AudienceDefinition map (must contain :id keyword)

Returns: definition

Register an audience definition in the in-process registry.

Validates the definition against AudienceDefinition schema before
registration. Throws ex-info on invalid input.

Args:
  definition - AudienceDefinition map (must contain :id keyword)

Returns:
  definition
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close