{"repo":"molvqingtai/comctx","free":true,"listed":false,"github":"https://github.com/molvqingtai/comctx","clone":"git clone https://github.com/molvqingtai/comctx.git","description":"Use RPC to communicate easily across contexts in any JavaScript environment.","language":"TypeScript","stars":122,"topics":["broadcastchannel","browser-extension","comlink","iframe","messagechannel","messageport","postmessage","rpc","service-worker","electron"],"license":"MIT","category":"ui-components","readme_excerpt":"Comctx Use RPC to communicate easily across contexts in any JavaScript environment. ✨Introduction Comctx aims to solve the communication problem between different contexts in a JavaScript environment. Comctx has a similar goal to Comlink, but it's not reinventing the wheel, as Comlink relies on MessagePort, which is limited in some environments (Issues: 438). Comctx enables flexible adaptation to different environments, such as: Web Workers, Browser Extensions, iframes, Electron, etc., making cross-context communication never easier. https://github.com/user-attachments/assets/d1601b54-2669-45d7-b1e5-9bbde1186856 💡Features - Environment Agnostic - Works across Web Workers, Browser Extensions, iframes, Electron, and more - Bidirectional Communication - Method calls & callback support - Zero Copy - Automatic extraction and zero-copy transfer of transferable objects - Type Safety - Full TypeScript integration - Lightweight - 2KB gzipped core - Fault Tolerance - Backup implementations & connection heartbeat checks 🚀 Quick Start Define Shared Service Define Adapter Provider (Service Provider) Injector (Service Injector) - originCounter and proxyCounter share the same Counter instance. proxyCounter is a virtual proxy that forwards requests to the Counter on the provider side, while originCounter directly references the Counter itself. - The injector side cannot directly use get and set ; it must interact with Counter via asynchronous methods, but callbacks are supported. - Since t","default_branch":null,"files":null,"tree":[],"storefront":"/r/molvqingtai","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/molvqingtai/comctx/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}