# Class: FlowCoreContext<TState>
FlowCoreContext
if the root of the Flo.w RDF JavaScript API.
Properties of this class expose functionality to consumers of the Flo.w RDF library.
Use the global ContextRegistry (exposed as flow
by the library) to initialize
a Flo.w RDF context in your application start-up code.
# Type parameters
Name | Default | Description |
---|---|---|
TState | any | Type of the reactive application state object. |
# Hierarchy
EventEmitter
↳ FlowCoreContext
# Constructors
# constructor
+ new FlowCoreContext(id
: string, host
: string, apiKey
: string, enableDebug?
: boolean): FlowCoreContext
Constructs a new FlowCoreContext
.
Use ContextRegistry.initializeContext to create an instance of FlowCoreContext
.
# Parameters:
Name | Type | Default value | Description |
---|---|---|---|
id | string | - | The ID of the context. |
host | string | - | The Flo.w Engine host URL. |
apiKey | string | - | The Flo.w Engine API key. |
enableDebug | boolean | false | Set to true to enable the debugger. |
Returns: FlowCoreContext
# Properties
# apiKey
• Readonly
apiKey: string
The Flo.w Engine API key.
# chartSpecs
• Readonly
chartSpecs: ChartSpecRegistry
The chart specification registry.
# debugger
• Readonly
debugger: Debugger
The Flo.w debugger. Available as window.FDBG
in the browser's web developer console.
# flowClient
• Readonly
flowClient: FlowClient
A Flo.w Engine client instance for performing low-level requests to Flo.w Engine.
See Flo.w Client Library for more details.
# host
• Readonly
host: string
The Flo.w Engine host URL.
# id
• Readonly
id: string
The ID of the context.
# imageLoader
• Readonly
imageLoader: ImageLoader
The map icon image loader.
# images
• Readonly
images: ImageRegistry
The map icon registry.
# maps
• Readonly
maps: MapRegistry
The map registry.
# palettes
• Readonly
palettes: PaletteRegistry
The palette registry.
# state
• Readonly
state: StateStore<TState>
Reactive application state.
# Methods
# emitError
▸ emitError(error
: Error): void
Emit an error.
Attach an error handler to respond to errors.
context.on('error', (error: Error) => {...handle error...});
If no error handler is attached an exception will be thrown.
# Parameters:
Name | Type |
---|---|
error | Error |
Returns: void
# emitWarning
▸ emitWarning(warning
: string): void
Emit a warning
Attach a warning handler to respond to warnings.
context.on('warn', (warning: string) => {...handle warning...});
If no warning handler is attached, the warning will be logged to the console.
# Parameters:
Name | Type |
---|---|
warning | string |
Returns: void