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.

How to use onclose event handler ?

See original GitHub issue

Hey, im wondering how to use onclose handler? Setting it directly db.onclose = () => {} fires a Uncaught (in promise) TypeError: Illegal invocation.

Any suggestions ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jakearchibaldcommented, Jan 9, 2020

I’ve added this as terminated and it’ll be in the next version. https://github.com/jakearchibald/idb#opendb

1reaction
jakearchibaldcommented, Aug 1, 2019

Your example above could be:

const db = await openDB('dbname', 1);
unwrap(db).onclose = () => console.log('closed');

I think I avoided the close event because of how confusing it is. It only fires if the connection is force-closed by the browser.

However, I guess I could just call it ‘forceclose’ instead of close.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTMLDialogElement: close event - Web APIs | MDN
Syntax. Use the event name in methods like addEventListener() , or set an event handler property. addEventListener('close', (event) => {}); ...
Read more >
OnClose Event | TestComplete Documentation
The OnClose event occurs when the dialog is closed. You can create an event handler for the OnClose event to perform specific actions...
Read more >
Capture event onclose browser - javascript - Stack Overflow
Events onunload or onbeforeunload you can't use directly - they do not differ between window close, page refresh, form submit, link click or...
Read more >
Form.OnClosed(EventArgs) Method (System.Windows.Forms)
The OnClosed method is obsolete starting with the .NET Framework 2.0; use the OnFormClosed method instead. Raising an event invokes the event handler...
Read more >
Vcl.Forms.TCustomForm.OnClose - RAD Studio API ...
Use OnClose to perform special processing when the form closes. The OnClose event specifies which event handler to call when a form is...
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