question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to update DocumentEventMap type

See original GitHub issue

Hello, I am working on adding support for the onvisibilitychange event listener to the document object in PR #359.

I was wondering how to also add compatibility for

document.addEventListener('visibilitychange' someEventHander)

which would mean adding the visibilitychange property to the DocumentEventMap interface.

However adding that property to addedTypes.json does not modify this interface in dom.generated.d.ts. Is there another way to submit a change to that?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
saschanazcommented, Jun 20, 2018

The code has been changed, now adding this to addedTypes.json will work:

{
  "Document": {
    "events": {
      "event": [
        {
          "name": "visibilitychange",
          "type": "Event"
        }
      ]
    }
  }
}
1reaction
saschanazcommented, Jun 20, 2018

#465 hasn’t been active for a while so you may open a new one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trying to update DocumentEventMap type · Issue #362 - GitHub
Hello, I am working on adding support for the onvisibilitychange event listener to the document object in PR #359.
Read more >
Typescript addEventListener set event type - Stack Overflow
In version 3.3.3333 they defined this way in the lib.dom.ts. addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: ...
Read more >
DocumentEventMap | typescript - v3.7.7
Inherited from GlobalEventHandlersEventMap.change. Defined in node_modules/typedoc/node_modules/typescript/lib/lib.dom.d.ts:5791 ...
Read more >
Using strongly typed events in TypeScript - 43081j
A quick few tips on how to use strongly typed events in TypeScript.
Read more >
Typesafe CustomEvents on your Frontend | by Inaki Anduaga
For instance, the React code that is in charge of updating the TotalCount ... and the payload ev is an index type of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found