Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The reopen event is not triggered when upgrading to 0.84.0 #8168

Open
2 of 3 tasks
imawizrd opened this issue Feb 16, 2024 · 2 comments
Open
2 of 3 tasks

The reopen event is not triggered when upgrading to 0.84.0 #8168

imawizrd opened this issue Feb 16, 2024 · 2 comments

Comments

@imawizrd
Copy link

imawizrd commented Feb 16, 2024

Issue Type

Before opening an issue, please search and see if it has already been raised.

  • Bug Report

  • Feature Request

  • Successfully reproduced against the latest version of NW.js?

Please use our mailing list or Gitter chatroom to ask questions. The issue tracker is only for bugs and feature requests, in English only. Please note that issues without a repro or code snippet are less likely to be resolved.

Current/Missing Behavior

The reopen event is never triggered.

Expected/Proposed Behavior

Each time the user clicks the Mac OS Dock icon of the application, the reopen event should be triggered, allowing the application to decide how to handle this event. This is because sometimes the app is minimized and sometimes it's hidden, so it may require different logic.

Additional Info

  • Operating System: macOS 14.13.1
  • NW.js Version: 0.84.0
  • Repro link: minrepro.zip
  • Code snippet:
  • Crash report:

Run npm i and start it with npm start, then follow these steps:

  1. click the close button of the window.
  2. Then click the dock icon to reopen. It should reopen.
  3. Close the window with close button.
  4. Click the dock icon again.
  5. These errors show in console, and the window is not reopened:
[69103:259:0216/194738.214409:ERROR:api_binding_hooks.cc(236)] Check failed: false. No callback found for the specified request ID.
[69103:259:0216/194738.843692:ERROR:api_binding_hooks.cc(236)] Check failed: false. No callback found for the specified request ID.
[69103:259:0216/194739.056158:ERROR:api_binding_hooks.cc(236)] Check failed: false. No callback found for the specified request ID.
[69103:259:0216/194739.236249:ERROR:api_binding_hooks.cc(236)] Check failed: false. No callback found for the specified request ID.
  1. Quit the app completely
  2. Edit package.json and downgrade nw to "^0.83.0"
  3. Update modules with rm -rf node_modules && npm install nw --nwjs_build_type=sdk && npm i
  4. Now version 83 should be installed. Repeat steps 1-4, the console errors in step 5 don't show anymore.
  5. Edit package json to upgrade to 84, the console errors in 5 show again.
@imawizrd
Copy link
Author

imawizrd commented Mar 9, 2024

This problem is still happening in latest version 0.85.0

friendly ping @rogerwang

@imawizrd
Copy link
Author

I found a seemingly working solution:

do not use:

nw.App.on("onreopen", () => {})

instead use:

nw.App.onReopen(() => {})

I found inspiration in this comment: #7860 (comment).

The website documentation does not mention this method for adding listeners.

The Typescript compiler may generate an error message because the type definitions are outdated:

declare namespace nw {
  export interface App {
    onReopen: {
      addListener: (arg: any) => void
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant