Show:

Engine is a singleton object that is required to run a Samsara application. It is the "heartbeat" of the application, managing the batching of streams and creating RootNodes and Contexts to begin render trees.

It also listens and can respond to DOM events on the HTML <body> tag and window object. For instance the resize event.

Item Index

Methods

Methods

add

(
  • object
)
RenderTreeNode

Extends the render tree subtree with a new node.

Parameters:

  • object SizeNode | LayoutNode | Surface

    Node

Returns:

RenderTreeNode:

deregisterContext

() static

Unsubscribe context from resize events

registerContext

() static

Subscribe context to resize events and start the render loop if not running

remove

()

Remove the View from the RenderTree. All Surfaces added to the View will also be removed. The View can be added back at a later time and all of its data and Surfaces will be restored.

start

() static

Initiate the Engine's request animation frame loop.

step

() private

Updates by a single frame of the application by looping through all function queues. This is repeatedly called within a requestAnimationFrame loop until the application is receiving no layout changes. At this point the requestAnimationFrame will be canceled until the next change.

stop

() static

Stop the Engine's request animation frame loop.