Behavior
- Kind
- class
- Source
- src/behaviors/Behavior.js:33
Description
Base class for reusable Helios application behaviors.
Signature
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | Serializable configuration owned by the behavior. |
Returns
Detached behavior instance; Helios attaches it through helios.useBehavior(...) or BehaviorManager.use(...).
BehaviorNotes
Behaviors attach to a Helios context, own serializable state, emit
change events, and register cleanup hooks for listeners, timers, and UI
bindings. Custom behaviors should override attach, detach, serialize,
and restore only where needed.
Instance Properties
id
Source: src/behaviors/Behavior.js:34
Id exposed by the class.
Network And Persistence
Network replacement, serialization, and visualization state persistence. ExporterBehavior and InterfaceBehavior can surface parts of this flow in the UI.
attach(context)
Source: src/behaviors/Behavior.js:44
Configures or reads attach.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
context | Value passed to attach. |
serialize()
Source: src/behaviors/Behavior.js:69
Handles serialize for the current graph or visualization state.
restore(snapshot = {}) → {this}
Source: src/behaviors/Behavior.js:73
Updates the restore state on the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
snapshot | optional | {} | Value passed to restore. |
Returns
This instance.
TypethisEvents
Event subscription helpers and emitted interaction events.
emit(type, detail)
Source: src/behaviors/Behavior.js:91
Configures or reads emit.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
type | string | Attribute value type. | ||
detail | Event payload passed to listeners. |
on(type, handler, options)
Source: src/behaviors/Behavior.js:96
Configures or reads on.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
type | string | Attribute value type. | ||
handler | Function | Callback invoked for the registered event. | ||
options | Object | Options object for this operation. |
Utilities
Additional public helpers that do not belong to a narrower API area.
detach()
Source: src/behaviors/Behavior.js:49
Manages detach for the current instance.
update(options = {}) → {Object|this}
Source: src/behaviors/Behavior.js:62
Read or set the update setting.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options | Object | optional | {} | Options object for this operation. |
Returns
Current update value when called without arguments; otherwise this instance for chaining.
TypeObject|thisExample
helios.update({
enabled: true,
});
addCleanup(cleanup) → {this}
Source: src/behaviors/Behavior.js:80
Manages cleanup for the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cleanup | Value passed to addCleanup. |
Returns
This instance.
TypethisremoveCleanup(cleanup)
Source: src/behaviors/Behavior.js:86
Manages cleanup for the current instance.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
cleanup | Value passed to removeCleanup. |