SDKDOMInstanceBase interface is used as the base class for runtime instances that create a DOM element. It derives from SDKWorldInstanceBase.
SDKDOMInstanceBase cannot be directly constructed; it should only be used as a base class.
- PostToDOMElement(handler, data)
- PostToDOMElementAsync(handler, data)
- Post a message from the runtime instance to the DOM side. The message is received using
AddDOMElementMessageHandler() in DOMElementHandler.
handler is a string identifying the kind of message.
data is a JSON object that is forwarded with the message to provide additional details. The async variant returns a promise that awaits an async handler on the DOM side and forwards the return value back to the runtime, which the returned promise resolves with. The non-async variant simply posts a message and ignores the result (i.e. fire-and-forget).
- Instruct the runtime to create a DOM element for this instance. It will end up calling
CreateElement() in DOMElementHandler with
data (an optional object with additional details to create with). The runtime associates the resulting element with this instance.
- Helper methods to manage calling
blur() on the instance's associated DOM element.
- SetElementCSSStyle(prop, val)
- Helper method to set a CSS style on the instance's associated DOM element. For example
SetElementCSSStyle("font-family", "sans-serif") will be forwarded to
elem.style.fontFamily = "sans-serif" on the DOM side.
- Override to return a JSON object representing the state of the DOM element, e.g. the text content. This is used by
UpdateElementState() to retrieve state to pass to the DOM side.
- Send a message from the runtime to the DOM side with the element state (retrieved from
GetElementState()). This results in a call to
UpdateState(elem, e) on the DOM side. This is a convenient way to make sure any changes to the DOM element are applied.
Addon SDK Manual
You are here:
Search this manual:
This manual entry was last updated on 7 Mar, 2019 at 13:20