ReportingObserver Class
Observes the reports generated by a document or a worker (https://w3c.github.io/reporting/#reportingobserver), e.g. the violations of its content security policies that have a report-to directive. Its callback is invoked from a task with the reports queued since the previous call.
public sealed class ReportingObserverConstructors
| Name | Description |
|---|---|
| ReportingObserver(GlobalScope, ReportingObserverCallback, ReportingObserverOptions?) | Creates an observer of the reports of a global object. |
| ReportingObserver(ReportingObserverCallback, ReportingObserverOptions?) | Creates an observer of the reports of the current global object (https://w3c.github.io/reporting/#dom-reportingobserver-reportingobserver). |
ReportingObserver overloads
ReportingObserver(GlobalScope, ReportingObserverCallback, ReportingObserverOptions?)
ReportingObserver.csCreates an observer of the reports of a global object.
public ReportingObserver(GlobalScope global, ReportingObserverCallback callback, ReportingObserverOptions? options = null)Parameters
globalGlobalScope- The window or the worker whose reports are observed.
callbackReportingObserverCallback- The callback invoked with the observed reports.
optionsReportingObserverOptions?- The observed types, and whether the reports generated before are observed.
ReportingObserver(ReportingObserverCallback, ReportingObserverOptions?)
ReportingObserver.csCreates an observer of the reports of the current global object (https://w3c.github.io/reporting/#dom-reportingobserver-reportingobserver).
public ReportingObserver(ReportingObserverCallback callback, ReportingObserverOptions? options = null)Parameters
callbackReportingObserverCallback- The callback invoked with the observed reports.
optionsReportingObserverOptions?- The observed types, and whether the reports generated before are observed.
See also
Methods
| Name | Description |
|---|---|
| Disconnect() | Stops observing the reports (https://w3c.github.io/reporting/#dom-reportingobserver-disconnect). The reports already queued are still delivered by the queued task. |
| Observe() | Starts observing the reports of the global object (https://w3c.github.io/reporting/#dom-reportingobserver-observe): with the buffered option, the reports of the report buffer are delivered too (once). |
| TakeRecords() | Returns the reports of the report queue and empties it (https://w3c.github.io/reporting/#dom-reportingobserver-takerecords). |
Disconnect()
ReportingObserver.csStops observing the reports (https://w3c.github.io/reporting/#dom-reportingobserver-disconnect). The reports already queued are still delivered by the queued task.
public void Disconnect()Observe()
ReportingObserver.csStarts observing the reports of the global object (https://w3c.github.io/reporting/#dom-reportingobserver-observe): with the buffered option, the reports of the report buffer are delivered too (once).
public void Observe()TakeRecords()
ReportingObserver.csReturns the reports of the report queue and empties it (https://w3c.github.io/reporting/#dom-reportingobserver-takerecords).
public IReadOnlyList<Report> TakeRecords()