components/behavior

Behavior widget.

Behavior widget screenshot.

Submodules

components/behavior/behavior

Behavior widget web component.

BEHAVIOR_TEMPLATE

type: string

Template string for behavior widget.

class BehaviorApi(id)

Behavior API for a given behavior ID.

Arguments
  • id (number()) – Behavior block id.

BehaviorApi.load_behavior()

Load behavior block for a given block id.

Returns

Promise – Behavior block.

BehaviorApi.load_behavior_states()

Load available behavior states.

Returns

Promise – Behavior states.

BehaviorApi.send_behavior_params(params)

Send behavior params to backend.

Returns

Promise – Updated behavior block.

BehaviorApi.toggle_behavior_playback()

Toggle behavior playback.

Returns

Promise – Updated behavior block.

class Behavior()

Behavior widget web component (<being-behavior>). This widget shows the different behavior states and the selected curves for each state. Additionally there is the attention span slider for the second state.

Important! Behavior id has to be set via a HTML attribute <being-behavior behaviorId=42></being-behavior> so that API requests can be mapped correctly.

Behavior.id

Get behavior id for this widget from “behaviorId” HTML attribute as int. Return -1 if not set.

Behavior.content_message(msg)

Process new content changed message from backend. Callback for web socket (js/web_socket.WebSocketCentral).

Arguments
  • msg (Object()) – Content changed message.

Behavior.emit_params()

Emit current behavior params to back end.

Behavior.init_html_elements()

Build DOM elements.

Behavior.load()

Load behavior state / params from server and populate HTML elements.

Behavior.mark_active_state(nr)

Mark active state.

Arguments
  • nr (number()) – State number. Currently 0, 1 or 2.

Behavior.new_behavior_message(msg)

Process new behavior message from backend. Callback for for web socket (js/web_socket.WebSocketCentral).

Arguments
  • msg (Object()) – Behavior message.

Behavior.populate_motions(names)

Update motion name lists.

Arguments
  • names (array()) – Motion names.

Behavior.populate_states(stateNames)

Populate box for each state.

Arguments
  • stateNames (array()) – Array of state names.

Behavior.pulse_led()

Trigger LED pulse animation for one cycle.

Behavior.update(behavior)

Update all UI elements from a behavior message.

Arguments
  • behavior (Object()) – Behavior info object.

Behavior.update_attention_span_label(duration)

Update content of attention span label.

Arguments
  • duration (number()) – Duration value.

Behavior.update_attention_span_slider(duration)

Update attention span elements.

Arguments
  • duration (number()) – Attention span time duration in seconds.