Class: FeatureBuilder<O, S, W>
A utility to create feature classes.
Type parameters
Name | Type | Default | Description |
---|---|---|---|
O | {} | {} | A type describing the shape of the JSON-serializable object that will be passed to the Web script. |
S | PropsSpecs<any, any> | {} | A type specifying the new properties added to the shell (capabilities to send message to the shell). |
W | WebHandlersSpecs<any> | {} | A type specifying the Web handlers added to the shell (capabilities to send message to the Web script). |
Hierarchy
- FeatureBuilder
Constructors
constructor
+ new FeatureBuilder(config
: FeatureBuilderConfig<O>): FeatureBuilder
Parameters:
Name | Type | Description |
---|---|---|
config | FeatureBuilderConfig<O> | An object to specify attributes of the feature. |
Returns: FeatureBuilder
Properties
config
• Private
config: any
Methods
build
â–¸ build(): FeatureClass<O, S, W>
Assemble this builder object into a feature class.
Returns: FeatureClass<O, S, W>
withShellHandler
â–¸ withShellHandler<N, P>(propName
: N, eventId?
: string): FeatureBuilder<O, S & PropsSpecs<N, (p: P) => void>, W>
Instruct that the shell will receive events from the Web, and provide a new handler prop for that purpose.
Type parameters:
Name | Type | Description |
---|---|---|
N | string | A type to define the name of the prop. |
P | - | A type describing the shape of payloads sent to shell handlers. |
Parameters:
Name | Type | Description |
---|---|---|
propName | N | The name of the handler prop added to the shell. It is advised to follow the convention of prefixing all these handlers with onDOM or onWeb to avoid collisions with WebView own props. |
eventId? | string | A unique identifier for the event received by the shell. If none is provided, fallback to "default" . |
Returns: FeatureBuilder<O, S & PropsSpecs<N, (p: P) => void>, W>
withWebHandler
â–¸ withWebHandler<I, P>(eventId
: I): FeatureBuilder<O, S, W & {}>
Instruct that the Web script will receive events from the shell. See WebshellInvariantProps.webHandleRef, WebHandle.postMessageToWeb and WebjsContext.onShellMessage.
Type parameters:
Name | Type | Default | Description |
---|---|---|---|
I | string | string | A type for the event identifier. |
P | - | undefined | A type describing the shape of payloads sent to Web handlers. |
Parameters:
Name | Type | Description |
---|---|---|
eventId | I | A unique identifier for the event received by the Web script. |
Returns: FeatureBuilder<O, S, W & {}>