Menu
pushmode

Class PushPage

PushMode » API Reference » pushmode



  • public abstract class PushPage
    extends Object
    Root of server-side object graph corresponding to some currently viewed page. PushMode is a stateful web framework. All currently open pages in browsers of all users have corresponding server-side state. This state is stored in multiple server-side objects and PushPage is the root of page's server-side object graph.
    The recommended practice is to define one derived class for every distinct page on the site. It is often desirable to create one or more "master" pages and then derive specialized pages from them. Every derived class must at the very minimum define document() method.
    Thread-safety:
    Every PushPage has an associated PageExecutor that can be obtained from executor() method. All page renders (executions of document()), DOM events, and DOM bindings are scheduled on the PageExecutor.
    Lifecycle:
    Whenever the user visits some page, corresponding PushPage instance is created. Instances of PushPage live for as long as the user keeps the page open (i.e. while keepalive messages keep coming) and some time after that to account for temporary connection loss.
    • Method Detail

      • document

        public abstract DomElement document()
        Renders the page, i.e. generates DOM tree of the page. Override this method to define HTML content of the page.
        Returns:
        Page's DOM tree with <html> root tag.
        Thread-safety:
        This method is run by page's executor().
        Reactive programming:
        This method is called as part of page's reactive computation, i.e. its dependencies are tracked and it is re-run every time its dependencies change.
      • experimental_onpushstarted

        @ExperimentalPushModeApi
        public void experimental_onpushstarted()
        Experimental API. It WILL be removed in future release.
      • experimental_onpushcomplete

        @ExperimentalPushModeApi
        public void experimental_onpushcomplete()
        Experimental API. It WILL be removed in future release.
      • request

        public PageRequest request()
        Initial request that opened this page.
        Returns:
        Page's initial HTTP request.
        Thread-safety:
        This method only reads immutable data.
      • pageId

        public String pageId()
        Globally unique page ID. Page IDs are produced by secure cryptographic random number generator. They never repeat.
        Returns:
        Page ID as a string matching regex [a-zA-Z0-9]+.
        Thread-safety:
        This method only reads immutable data.
      • browser

        public pushmode.apis.MirrorBrowser browser()
        Access browser APIs for this page.
        Returns:
        Page's MirrorBrowser.
        See Also:
        PageRequest.pageId()
        Thread-safety:
        This method only reads immutable data.
      • executor

        public PageExecutor executor()
        Page's event loop. All page renders and all DOM events and bindings run in this event loop.
        Returns:
        Page's event loop.
        Thread-safety:
        This method only reads immutable data.