{"id":27443023,"url":"https://github.com/zekiah-a/shared-ipc","last_synced_at":"2025-09-14T06:37:49.191Z","repository":{"id":287741984,"uuid":"965648491","full_name":"Zekiah-A/shared-ipc","owner":"Zekiah-A","description":"A simple JavaScript library providing an asynchronous method call interface for Workers, Iframes and cross-window contexts","archived":false,"fork":false,"pushed_at":"2025-07-15T21:41:03.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-19T05:53:59.135Z","etag":null,"topics":["communication","iframe","inter-process","ipc","javascript","npm","postmessage","worker"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/shared-ipc","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/Zekiah-A.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,"zenodo":null}},"created_at":"2025-04-13T16:12:41.000Z","updated_at":"2025-07-15T21:41:06.000Z","dependencies_parsed_at":"2025-04-15T01:18:29.114Z","dependency_job_id":"75bdaddc-218c-4e70-8fff-15c6480bf74c","html_url":"https://github.com/Zekiah-A/shared-ipc","commit_stats":null,"previous_names":["zekiah-a/shared-ipc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Zekiah-A/shared-ipc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zekiah-A%2Fshared-ipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zekiah-A%2Fshared-ipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zekiah-A%2Fshared-ipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zekiah-A%2Fshared-ipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zekiah-A","download_url":"https://codeload.github.com/Zekiah-A/shared-ipc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zekiah-A%2Fshared-ipc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275071546,"owners_count":25400398,"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-09-14T02:00:10.474Z","response_time":75,"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":["communication","iframe","inter-process","ipc","javascript","npm","postmessage","worker"],"created_at":"2025-04-15T01:18:27.179Z","updated_at":"2025-09-14T06:37:49.169Z","avatar_url":"https://github.com/Zekiah-A.png","language":"JavaScript","readme":"# shared-ipc\n\nA simple JavaScript library providing an asynchronous method call interface for Workers, Iframes and cross-window contexts using postMessage.\n\n## Installation\n\n```bash\nnpm install shared-ipc\n```\n\n## Usage\n\n### Basic Setup\n\n```javascript\nimport { \n  makeIpcRequest, \n  sendIpcMessage, \n  addMessageHandler, \n  handleMessage \n} from \"shared-ipc\";\n\n// In both frames/workers:\nwindow.addEventListener(\"message\", handleMessage);\n\n// Add message handlers\naddMessageHandler(\"greet\", (name) =\u003e {\n  return `Hello ${name}!`;\n});\n\n// In parent frame communicating with iframe:\nconst iframe = document.getElementById(\"my-iframe\");\nawait makeIpcRequest(iframe, \"greet\", \"World\"); // Returns \"Hello World!\"\n\n// Or send a message without waiting for response\nsendIpcMessage(iframe, \"notification\", { type: \"alert\" });\n```\n\n## API\n\n### `makeIpcRequest(target:IpcTarget, call:string, data:any)`\nMakes an IPC request and returns a promise that resolves with the response.\n\n### `sendIpcMessage(target:IpcTarget, call:string, data:any)`\nSends an IPC message without waiting for a response.\n\n### `addIpcMessageHandler(name:string, handler:Function)`\nAdds a handler function for a specific message type.\n\n### `handleIpcMessage(data:IpcEventData)`\nThe message event handler that processes incoming messages.\n\n### `PublicPromise`\nUtility class used internally for managing promise resolution.\n\n### `IpcTarget` compatibility matrix:\n| Type                   | Window (Browser) | Worker (Browser) | MessagePort (Node) | \n|------------------------|------------------|------------------|--------------------|\n| **Window (Browser)**   | ✅ Yes           | ✅ Yes           | ❌ No              |\n| **Worker (Browser)**   | ✅ Yes           | ✅ Yes           | ❌ No              |\n| **Iframe (Browser)**   | ✅ Yes           | ✅ Yes           | ❌ No              |\n| **MessagePort (Node)** | ❌ No            | ❌ No            | ✅ Yes             |\n| **Worker (Node)**      | ❌ No            | ❌ No            | ✅ Yes             |\n\n\n## License\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzekiah-a%2Fshared-ipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzekiah-a%2Fshared-ipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzekiah-a%2Fshared-ipc/lists"}