beacon method

bool beacon({
  1. required String url,
  2. CObject? data,
})

Sends an HTTP POST request containing a small amount of data to a web server. It's intended to be used for sending analytics data to a web server, and avoids some of the problems with legacy techniques for sending analytics, such as the use of XMLHttpRequest.

See https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API

Implementation

bool beacon({required String url, CObject? data}) {
  return web.window.navigator.sendBeacon(url, data?.jsify());
}