Options
All
  • Public
  • Public/Protected
  • All
Menu

The builder handles the integration of the Event/Message Driven approach provided natively by <ceb/>. Its purpose is to provide a quick and efficient way to interact with the Gateway within the Custom Element. Therefore, it is easy to execute queries to get data, execute commands to generate side effects and finally listen to events to react on side effects.

First, the Gateway is created and set to a readonly property, by default its name is gateway. By default, the global channel is window, it can be overridden with {@link AbstractGatewayBuilder.global}

Then, subscriptions can be registered with AbstractGatewayBuilder.subscribe. When the builder is used as a decorator, then AbstractGatewayBuilder.subscribe provides an instance of GatewaySubscriptionBuilder which can be used to easily configure a subscription.

The gateway starts when the Custom Element is connected, c.f. connectedCallback and, stops when it is disconnected, c.f. disconnectedCallback.

The builder can be used many times by Custom Element. There will be a unique Gateway instance per properties.

template the

type of the Custom Element

Type parameters

  • E: HTMLElement

Hierarchy

  • AbstractGatewayBuilder

Implements

  • Builder<E>

Index

Constructors

Protected constructor

Properties

Protected _gatewayProvider

_gatewayProvider: GatewayProvider

_propName

_propName: string = "gateway"
internal

Protected _subscriptionsByType

_subscriptionsByType: Map<string, [ElementSubscriptionListener<HTMLElement, Event<any, MessageHeaders>>, undefined | SubscribeOptions][]> = ...

Methods

Protected build

  • build(Constructor: CustomElementConstructor<E>, hooks: HooksRegistration<E & { __ceb_gateway_subscriptions: Set<Removable> }>): void
  • This API is dedicated for developer of Builders.

    Parameters

    • Constructor: CustomElementConstructor<E>
    • hooks: HooksRegistration<E & { __ceb_gateway_subscriptions: Set<Removable> }>

    Returns void

decorate

  • decorate(): PropertyDecorator

subscribe

Generated using TypeDoc