Class: FeatureBuilder<O, S, W>

A utility to create feature classes.

Type parameters

NameTypeDefaultDescription
O{}{}A type describing the shape of the JSON-serializable object that will be passed to the Web script.
SPropsSpecs<any, any>{}A type specifying the new properties added to the shell (capabilities to send message to the shell).
WWebHandlersSpecs<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:

NameTypeDescription
configFeatureBuilderConfig<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:

NameTypeDescription
NstringA type to define the name of the prop.
P-A type describing the shape of payloads sent to shell handlers.

Parameters:

NameTypeDescription
propNameNThe 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?stringA 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:

NameTypeDefaultDescription
IstringstringA type for the event identifier.
P-undefinedA type describing the shape of payloads sent to Web handlers.

Parameters:

NameTypeDescription
eventIdIA unique identifier for the event received by the Web script.

Returns: FeatureBuilder<O, S, W & {}>