Class ServerEventObject


  • public final class ServerEventObject
    extends com.google.gwt.core.client.JavaScriptObject
    A representation of a server object able to send notifications to the server.
    Since:
    1.0
    Author:
    Vaadin Ltd
    • Constructor Detail

      • ServerEventObject

        protected ServerEventObject()
        JSO constructor.
    • Method Detail

      • defineMethod

        public void defineMethod​(String methodName,
                                 StateNode node,
                                 boolean returnPromise)
        Defines a method with the given name to be a callback to the server for the given state node.

        Note! If the Polymer.Element contains an implementation for methodName it will be run before the server-side method.

        Parameters:
        methodName - the name of the method to add
        node - the node to use as an identifier when sending an event to the server
        returnPromise - true if the handler should return a promise that will reflect the server-side result; false to not return any value
      • removeMethod

        public void removeMethod​(String methodName)
        Removes a method with the given name.
        Parameters:
        methodName - the name of the method to remove
      • getMethods

        public JsArray<String> getMethods()
        Gets the defined methods.
        Returns:
        an array of defined method names
      • get

        public static ServerEventObject get​(elemental.dom.Element element)
        Gets or creates element.$server for the given element.
        Parameters:
        element - the element to use
        Returns:
        a reference to the $server object in the element
      • getIfPresent

        public static ServerEventObject getIfPresent​(elemental.dom.Node node)
        Gets or creates element.$server for the given element, if present.
        Parameters:
        node - the element to use
        Returns:
        a reference to the $server object in the element, or null if note present.
      • getOrCreateExpression

        protected static com.vaadin.client.flow.binding.ServerEventObject.ServerEventDataExpression getOrCreateExpression​(String expressionString)
      • rejectPromises

        public void rejectPromises()
        Reject all promises pending on this server object. Called during client resynchronization to free consumers of promises that are never delivered by the server.