Instance Methods
Control a created widget instance after TradingWidget.create().
Method Summary
destroy()
Remove the iframe, clear listeners, and emit destroyed once for the current instance.
getState()
Read the current lifecycle state of the widget instance.
Return values include loading, authenticating, ready, error, and destroyed.
whenReady()
Wait for the iframe to finish initialization before running dependent UI logic.
setSymbol(symbol)
Switch the trading pair inside the iframe. If the iframe is still initializing, the SDK queues the command and sends it after ready.
setTheme(theme)
Update the theme parameter used by the embedded trading iframe.
setLocale(locale)
Switch the iframe language. Supported values are en, en-US, and zh-CN.
setSize(width, height)
Update the iframe DOM size and notify the iframe about the new outer size. Numeric values are converted to px.
reload()
Reload the current iframe and wait for it to initialize again.
refreshAuth(reason)
Ask the iframe to refresh the current authentication flow. The optional reason value is forwarded for logging and flow control.
setTokenProvider(provider)
Replace the tokenProvider used by partner-token mode. The SDK calls the provider when the iframe requests a fresh embed token.
on(event, handler)
Subscribe to a runtime event. The returned function removes the listener.