{"id":21906653,"url":"https://github.com/enlight/electron-menu-promise-delay-demo","last_synced_at":"2026-05-13T23:36:23.434Z","repository":{"id":137247268,"uuid":"61427979","full_name":"enlight/electron-menu-promise-delay-demo","owner":"enlight","description":"Demonstration of delayed promise resolution in Electron menu item click handlers","archived":false,"fork":false,"pushed_at":"2016-06-18T12:09:22.000Z","size":209,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T07:29:35.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enlight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-18T10:12:43.000Z","updated_at":"2016-06-18T11:03:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7c7859b-1bee-45f6-b7a7-6eba7f9edce5","html_url":"https://github.com/enlight/electron-menu-promise-delay-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/enlight/electron-menu-promise-delay-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-menu-promise-delay-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-menu-promise-delay-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-menu-promise-delay-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-menu-promise-delay-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enlight","download_url":"https://codeload.github.com/enlight/electron-menu-promise-delay-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enlight%2Felectron-menu-promise-delay-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272013576,"owners_count":24858475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-28T16:54:10.604Z","updated_at":"2025-10-25T22:08:51.212Z","avatar_url":"https://github.com/enlight.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# electron-menu-promise-delay-demo\nDemo of delayed promise execution in Electron menu item `click` handlers\n\n![Screen capture of demo app](/demo.gif?raw=true \"Demo\")\n\n## Setup\n\nInstall the dependencies for the demo app:\n\n```shell\nnpm install\n```\n\nThen run it:\n\n```shell\nnpm start\n```\n\n## Observations\n\nThese observations were made on a system running:\n\n- Windows 8.1 x64\n- Electron v1.2.3 x64 and v0.36.11 x64\n\nPromises in Electron menu item `click` handlers don't appear to be executed\nuntil the mouse cursor is moved or the page is clicked on. In this demo app\nit is sufficient to move the mouse cursor on the page ever so slightly, but\nin another app of mine the cursor must be moved off the page completely.\n\nThis app creates a window/app menu where each item sends an IPC message to\nthe renderer process, which in turn displays the message on the index page.\nThe menu items are described below.\n\n### `PromiseFirst` Menu\nThe first item in this menu sends the IPC message from inside a promise, while\nthe last item sends the message directly. Clicking on the `Ping Promise` item\nwill have no visible effect until the mouse cursor is moved or the page is\nclicked on.\n\n### `PromiseLast` Menu\nThe first item in this menu sends the IPC message directly, while the last item\nsends the message from inside a promise. Oddly enough clicking on the `Ping\nPromise` item in this menu will in fact have an immediate effect.\n\n### `PromiseLastNotWorking` Menu\nThis menu is setup exactly the same as the `PromiseLast` menu, but clicking on\nthe `Ping Promise` item in this menu will not have an immediate effect!\n\n### `JustPromises` Menu\nThis menu only contains items that send IPC messages from inside promises,\nclicking on either item has no effect until the mouse cursor is moved or the\npage is clicked on.\n\n### `Workaround` Menu\nIn this menu the promises within the `click` handlers are wrapped in calls\nto `setImmediate()` or `process.nextTick()`, this seems to ensure that the\npromises are executed in a timely manner.\n\n## Additional Notes\n\nWhile this app only creates a window/app menu the `click` handlers in context\nmenu items appear to suffer from exactly the same issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenlight%2Felectron-menu-promise-delay-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenlight%2Felectron-menu-promise-delay-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenlight%2Felectron-menu-promise-delay-demo/lists"}