{"id":22474712,"url":"https://github.com/mikehall314/electron-comlink","last_synced_at":"2025-10-14T10:03:13.065Z","repository":{"id":57221559,"uuid":"112871135","full_name":"mikehall314/electron-comlink","owner":"mikehall314","description":"An adapter for Electron IPC to allow communication with Comlink","archived":false,"fork":false,"pushed_at":"2020-08-27T16:30:40.000Z","size":24,"stargazers_count":9,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T09:15:07.408Z","etag":null,"topics":["comlink","electron","ipc"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikehall314.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}},"created_at":"2017-12-02T19:37:00.000Z","updated_at":"2024-09-19T14:45:08.000Z","dependencies_parsed_at":"2022-08-29T04:01:55.376Z","dependency_job_id":null,"html_url":"https://github.com/mikehall314/electron-comlink","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mikehall314/electron-comlink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikehall314%2Felectron-comlink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikehall314%2Felectron-comlink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikehall314%2Felectron-comlink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikehall314%2Felectron-comlink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikehall314","download_url":"https://codeload.github.com/mikehall314/electron-comlink/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikehall314%2Felectron-comlink/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261080624,"owners_count":23106602,"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","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":["comlink","electron","ipc"],"created_at":"2024-12-06T13:10:11.512Z","updated_at":"2025-10-14T10:03:08.024Z","avatar_url":"https://github.com/mikehall314.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/mikehall314/electron-comlink.svg?branch=main)](https://travis-ci.org/mikehall314/electron-comlink)\n\n# electron-comlink\n\nAn adapter to allow Electron to use [Comlink](https://github.com/GoogleChromeLabs/comlink) to communicate between the background and renderer processes.\n\n# Installation\n\n`npm install electron-comlink`\n\n# Usage\n\n## Communicate from the background to the renderer\n\n```js\n// In the renderer process\nconst Comlink = require(\"comlink\");\nconst {ElectronMessageAdapter} = require(\"electron-comlink\");\nconst endpoint = new ElectronMessageAdapter(window, electron.ipcRenderer);\n\nconst exposed = {\n    doSomething() {\n        return \"Did something in the renderer\";\n    },\n};\n\nComlink.expose(exposed, endpoint);\n```\n\n```js\n// In the background process\nconst Comlink = require(\"comlink\");\nconst {ElectronMessageAdapter} = require(\"electron-comlink\");\n\nconst win = new BrowserWindow({width: 800, height: 600});\nconst endpoint = new ElectronMessageAdapter(win, electron.ipcMain);\n\nconst link = Comlink.wrap(endpoint);\nawait link.doSomething(); // Returns \"Did something in the renderer\"\n```\n\n## Communicate from the renderer to the background\n\n```js\n// In the background process\nconst Comlink = require(\"comlink\");\nconst {ElectronMessageAdapter} = require(\"electron-comlink\");\n\nconst win = new BrowserWindow({width: 800, height: 600});\nconst endpoint = new ElectronMessageAdapter(win, electron.ipcMain);\n\nconst exposed = {\n    doSomethingElse() {\n        return \"Did something in the background\";\n    },\n};\n\nComlink.expose(exposed, endpoint);\n```\n\n```js\n// In the renderer process\nconst Comlink = require(\"comlink\");\nconst {ElectronMessageAdapter} = require(\"electron-comlink\");\nconst endpoint = new ElectronMessageAdapter(window, electron.ipcRenderer);\n\nconst link = Comlink.wrap(endpoint);\nawait link.doSomethingElse(); // Returns \"Did something in the background\"\n```\n\n# Gotchas\n\n-   The `transferList` argument to `.postMessage()` is not currently supported.\n-   If you try to message the renderer before it has started up, then you could\n    be `await`ing forever\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikehall314%2Felectron-comlink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikehall314%2Felectron-comlink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikehall314%2Felectron-comlink/lists"}