Class ElementJsInitializerRegistration

java.lang.Object
com.vaadin.flow.dom.impl.ElementJsInitializerRegistration
All Implemented Interfaces:
Registration, Serializable

public final class ElementJsInitializerRegistration extends Object implements Registration
Server-side bookkeeping for a JavaScript initializer registered through Element.addJsInitializer(String, Object...) or Element.addJsInitializer(JsFunction).

Re-emits the init invocation each time the client acquires a fresh DOM for this element, and emits a matching dispose when the registration is removed. The initializer is sent as a JsFunction parameter of the declared ElementJsInitializerRegistration.InitializerJs calls, which delegate the registry bookkeeping to the registerInitializer / disposeInitializer callbacks of the client-side execution context. An initializer declared as a snippet is therefore not compiled from a string in the browser.

For internal use only.

Since:
25.2
See Also:
  • Constructor Details

    • ElementJsInitializerRegistration

      public ElementJsInitializerRegistration(StateNode node, String expression, Object[] parameters)
      Creates a new registration for an expression given by the application and schedules the first init invocation if the node is currently attached. The expression is compiled from a string in the browser.
      Parameters:
      node - the owning state node, not null
      expression - the user-supplied expression, not null
      parameters - the user-supplied parameters, captured by the JsFunction
    • ElementJsInitializerRegistration

      public ElementJsInitializerRegistration(StateNode node, JsFunction initializer)
      Creates a new registration for the given initializer and schedules the first init invocation if the node is currently attached.

      The initializer is applied with the element as this and no arguments, and returns a cleanup function, null or undefined, as described for Element.addJsInitializer(String, Object...). One declared as a snippet is not compiled from a string in the browser.

      Parameters:
      node - the owning state node, not null
      initializer - the initializer to run, not null
  • Method Details