Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • Parameters

    • __namedParameters: ServerOpts
    • registry: Object = {}

      Registry of components and their Wafer definitions that should be upgraded if found in the component template

    Returns default

Properties

_attrToProp

_attrToProp: Object

Object of attribute names to property names

_changing

_changing: boolean

Flag indicating pending property changes are being processed

_connectedOnce

_connectedOnce: boolean

Flag indicating if element has been connected to DOM at least once

_element

_element: ServerElement

Element containing reference to underlying HTMLElement implementation. The element is proxied in this class to:

  • avoid clashes with HTMLElement implementation details

  • make it easy to swap out for alternative implementations

_firstUpdate

_firstUpdate: boolean

Flag indicating if this is the first update to occur

_initials

_initials: Object

Initial values of properties

_newChanges

_newChanges: boolean

Flag indicating if there are any pending changes in the current update cycle

_propNames

_propNames: string[]

Array of property names

_props

_props: Object

Current values of properties <string, any>

_registry

_registry: Object

_removeUnreflectedAttributes

_removeUnreflectedAttributes: boolean

Indicates if unreflected attributes should be removed on initialisation

_shadow

_shadow: ShadowOpts

Type of shadow root (open/closed) or falsey for none

_tagName

_tagName: string

Tag name that this component will be rendered within

_toUpdate

_toUpdate: Map<string, any>

Map of all properties to their new values, that have changed in the current update cycle

_updatePromise

_updatePromise: null | Promise<void>

Promise that will resolve when all the current updates have been triggered

shadowRoot

shadowRoot: null | ServerElement

Holds the server implementation of a shadow root if required

Accessors

_needsRehydrating

  • get _needsRehydrating(): boolean
  • Returns true if the component has been rendered on the server and has not yet been hydrated. Only true in client context

    Returns boolean

attributes

  • get attributes(): Object

childNodes

firstChild

innerHTML

  • set innerHTML(html: string): void
  • Set the innerHTML of underlying element

    Parameters

    • html: string

    Returns void

nodeType

  • get nodeType(): NodeType

parentNode

props

  • get props(): Object

rawTagName

  • get rawTagName(): string
  • The tag name of the original element. This is used internally by node-html-parser and needs to br proxied here so a ServerElement can be used everywhere node-html-parser's HTMLElement is

    Returns string

tagName

  • get tagName(): string

textContent

  • get textContent(): string
  • set textContent(content: string): void

Static observedAttributes

  • get observedAttributes(): string[]
  • A list of all attributes whose values should be used to set properties, using attributeName set in props if available

    Returns string[]

Static props

  • get props(): Object

Static template

  • get template(): string

Methods

_getter

  • _getter(name: string): () => any
  • Returns a getter for named property

    Parameters

    • name: string

      Property name

    Returns () => any

      • (): any
      • Returns any

_setFromAttribute

  • _setFromAttribute(name: string, value: null | string): void
  • Sets property value from named attribute

    Parameters

    • name: string

      Property name

    • value: null | string

      Attribute value

    Returns void

_setFromProp

  • _setFromProp(name: string, value: any): void
  • Sets attribute from named property value

    Parameters

    • name: string

      Property name

    • value: any

      Property value

    Returns void

_setter

  • _setter(name: string): (value: any) => void
  • Returns a setter method for named property

    Parameters

    • name: string

      Property name

    Returns (value: any) => void

      • (value: any): void
      • Parameters

        • value: any

        Returns void

appendChild

  • Append a child to the underlying element implementation

    Parameters

    Returns void

attachShadow

  • attachShadow(__namedParameters: { mode: "open" | "closed" }): ServerElement
  • Create and attach a shadow root, which on the server is an instance of a template ServerElement

    Parameters

    • __namedParameters: { mode: "open" | "closed" }
      • mode: "open" | "closed"

    Returns ServerElement

attributeChangedCallback

  • attributeChangedCallback(name: string, oldValue: null | string, newValue: null | string): void
  • Callback triggered when an attribute with a name matching a property name is changed

    Parameters

    • name: string

      Attribute name

    • oldValue: null | string

      Old attribute value

    • newValue: null | string

      New attribute value

    Returns void

changed

  • changed(changed: Map<string, any>): void | string[] | Promise<string[]>
  • Called when all pending property value changes have been processed, but before their targets have been updated. Changes made to properties in this callback will not trigger another update, but the updated values will be used for the current update.

    Parameters

    • changed: Map<string, any>

      A Map of properties and their old values that have changed in the current cycle

    Returns void | string[] | Promise<string[]>

    If an array of property names (or a Promise that resolves to an array) is returned then those properties will not have their targets updated. If a promise is returned then it will be awaited

connectedCallback

  • connectedCallback(): Promise<void>
  • Called when an element is 'attached' to the DOM on the server. This is called explicitly on the server before rendering takes place

    Returns Promise<void>

construct

  • construct(): Promise<void>

firstUpdated

  • firstUpdated(updated: Map<string, any>): void | Promise<void>
  • Called after the initial update of this component has occurred.

    Parameters

    • updated: Map<string, any>

    Returns void | Promise<void>

getAttribute

  • getAttribute(key: string): string
  • Return the current value of names attribute

    Parameters

    • key: string

      Attribute name

    Returns string

getElement

hasAttribute

  • hasAttribute(key: string): boolean
  • Does this element have an attribute set with named key

    Parameters

    • key: string

      Attribute name

    Returns boolean

initialiseProps

  • initialiseProps(): void
  • Set up initial values of properties

    Returns void

querySelector

  • Query underlying element for single match

    Parameters

    • selector: string

      CSS3 selector

    Returns ServerElement

querySelectorAll

  • Query underlying element for all matches

    Parameters

    • selector: string

    Returns ServerElement[]

removeAttribute

  • removeAttribute(key: string): void
  • Proxy for getAttribute in ServerElement ensuring attributeChangedCallback is called on this component

    Parameters

    • key: string

    Returns void

requestUpdate

  • requestUpdate(props?: undefined | null | string[]): Promise<void>
  • Manually request an update cycle to run

    Parameters

    • props: undefined | null | string[] = []

    Returns Promise<void>

setAttribute

  • setAttribute(key: string, value: string): void
  • Proxy for setAttribute in ServerElement ensuring attributeChangedCallback is called on this component

    Parameters

    • key: string
    • value: string

    Returns void

setAttributes

  • setAttributes(attrs: Object): void
  • Sets all attributes at once

    Parameters

    • attrs: Object

      Value to set

    Returns void

setElement

  • Update the underlying element to new element

    Parameters

    Returns void

setupPropValues

  • setupPropValues(): void
  • Set initial property values

    Returns void

triggerUpdate

  • triggerUpdate(): Promise<void>
  • Trigger an update to the component that will be run at the end of the current task

    Returns Promise<void>

update

  • update(props?: undefined | null | string[]): void
  • Update property targets for all properties whose values have changed or have been manually requested

    Parameters

    • props: undefined | null | string[] = []

    Returns void

updateDone

  • updateDone(): Promise<void>
  • updateDone(registry: Object): Promise<void>
  • Returns a promise that will resolve when the current update cycle is complete, or immediately if there is no update pending.

    Returns Promise<void>

  • Promise resolves when all pending updates have been processed

    Parameters

    • registry: Object

      registry of tag names to Wafer component definitions

    Returns Promise<void>

updateTargets

  • updateTargets(name: string): Promise<void>
  • Update the targets for property

    Parameters

    • name: string

    Returns Promise<void>

updated

  • updated(updated: Map<string, any>): void | Promise<void>
  • Called when all pending property target updates have been called. Changes made to properties in this callback will trigger another update cycle.

    Parameters

    • updated: Map<string, any>

      A Map of properties and their old values that have had their targets updated in the current cycle.

    Returns void | Promise<void>

    If a promise is returned then it will be awaited - this is useful in a server context where, if further work is initiated that results in property changes (and targets updated), the response shouldn't be set until all changes have been processed.

Generated using TypeDoc