Context (Commerce Engine)
Context (Commerce Engine)
|
Note
This component was introduced in version |
The Context
controller exposes methods for managing the global context in a commerce interface.
Methods
subscribe
Adds a callback that’s invoked on state change.
Parameters
-
listener:
() => void
A callback that’s invoked on state change.
Returns Unsubscribe
: A function to remove the listener.
Attributes
state
A scoped and simplified part of the headless state that is relevant to the Context
controller.
Properties
-
country:
string
-
currency:
CurrencyCodeISO4217
-
language:
string
-
view:
View
Initialize
buildContext
Creates a Context
controller instance.
Parameters
-
engine:
CommerceEngine
The headless commerce engine.
-
props:
ContextProps
The configurable
Context
properties.
Returns Context
ContextProps
The configurable Context
properties.
Properties
-
options?:
ContextOptions
The initial options that should be applied to this
Context
controller.
ContextOptions
The initial options that should be applied to this Context
controller.
Properties
-
country:
string
-
currency:
CurrencyCodeISO4217
-
language:
string
-
view:
View