These docs are for v1.1. Click to read the latest docs for v1.4.

Using the OnDOMReady Event

We recommend performing all JavaScript / C bindings within the OnDOMReady event-- this is called when the page has finished parsing the document and is ready to execute scripts.

Attaching with the LoadListener interface

This event is part of the LoadListener interface, we will inherit from it and bind it to our View.

#include <Ultralight/Ultralight.h>

using namespace ultralight;

class MyListener : public LoadListener {
public:
  MyListener(View* view) {
    view->set_load_listener(this);
  }
  
  virtual ~MyListener() {}
  
  virtual void OnDOMReady(View* view) override {
    // Handle OnDOMReady here.
  }
};