Skip to content

Add new scriptlet — 'trusted-dispatch-event' #382

Description

@AdamWr

It could be useful in this case - AdguardTeam/AdguardFilters#166126
Instead of allowing cookie notice and closing it, we could use dispatchEvent() to load video player.

Something like:

function dispatchCustomEvent(event, element) {
  if (!event) {
    return;
  }
  const ev = new CustomEvent(event);
  const el = element ? document.querySelector(element) : document;
  if (el) {
   el.dispatchEvent(ev);
  }
}

and then:

dispatchCustomEvent('consentGranted')

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions