addTimingsCallback method

void addTimingsCallback (
  1. TimingsCallback callback

Add a TimingsCallback that receives FrameTiming sent from the engine.

This can be used, for example, to monitor the performance in release mode, or to get a signal when the first frame is rasterized.

This is preferred over using Window.onReportTimings directly because addTimingsCallback allows multiple callbacks.

If the same callback is added twice, it will be executed twice.


void addTimingsCallback(TimingsCallback callback) {
  if (_timingsCallbacks.length == 1) {
    assert(window.onReportTimings == null);
    window.onReportTimings = _executeTimingsCallbacks;
  assert(window.onReportTimings == _executeTimingsCallbacks);