Giter Club home page Giter Club logo

Comments (3)

sondreb avatar sondreb commented on June 11, 2024

With the single popup mutex, the lock is never released if the user clicks X as oppose to "Cancel". To fix it, user must restart browser or enable/disable the extension.

While working on handling the beforeunload event, it appears it's not entirely deterministic and depends on user interaction with the window. I have not been able to find any specific patterns, even if I click within the window, sometimes the beforeunload is simply not called. If I open the debug console on popup with an debugger statement, then the unload event it always called.

MDN: As of Chrome 60, the confirmation [will be skipped](https://chromestatus.com/feature/5082396709879808) if the user has not performed a gesture in the frame or page since it was loaded. Pressing F5 in the page seems to count as user interaction, whereas mouse-clicking the refresh arrow or pressing F5 with Chrome DevTools focused does not count as user interaction (as of Chrome 81).

A better solution will be to actually listen to the closing (finally) on windows.create (returns a Promise).

I'll get back to this issue when I have a good solution, working on it now.

from nos2x.

sondreb avatar sondreb commented on June 11, 2024

Got a working solution here, it will listen to the close event and perform a call to handlePromptMessage with condition 'no' if the prompt object is still there after window close:

nos2x-exit

Previously if users dismissed with X, the extension wouldn't be able to popup new windows.

PR incoming!

from nos2x.

fiatjaf avatar fiatjaf commented on June 11, 2024

Nice animation.

from nos2x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.