{"id":15711281,"url":"https://github.com/ckaznable/web-ext-msg-passing","last_synced_at":"2026-05-01T09:32:24.251Z","repository":{"id":37670336,"uuid":"504085774","full_name":"ckaznable/web-ext-msg-passing","owner":"ckaznable","description":"functional interface web extension message passing wrapped","archived":false,"fork":false,"pushed_at":"2022-11-23T08:15:10.000Z","size":84,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T15:42:59.268Z","etag":null,"topics":["browser-extension","chrome-extension","message-passing","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/web-ext-msg-passing","language":"TypeScript","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/ckaznable.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-06-16T09:05:26.000Z","updated_at":"2023-03-17T13:04:34.000Z","dependencies_parsed_at":"2022-07-14T04:20:32.717Z","dependency_job_id":null,"html_url":"https://github.com/ckaznable/web-ext-msg-passing","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ckaznable/web-ext-msg-passing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckaznable%2Fweb-ext-msg-passing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckaznable%2Fweb-ext-msg-passing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckaznable%2Fweb-ext-msg-passing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckaznable%2Fweb-ext-msg-passing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ckaznable","download_url":"https://codeload.github.com/ckaznable/web-ext-msg-passing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ckaznable%2Fweb-ext-msg-passing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32492177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["browser-extension","chrome-extension","message-passing","typescript"],"created_at":"2024-10-03T21:12:24.947Z","updated_at":"2026-05-01T09:32:24.233Z","avatar_url":"https://github.com/ckaznable.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://img.shields.io/npm/v/web-ext-msg-passing?color=g)](https://www.npmjs.com/package/web-ext-msg-passing)\n\n# web extension message passing wrapped\n\nfunctional interface web extension message passing wrapped\n\n## Example\n\nRefer to this [repository](https://github.com/ckaznable/web-ext-msg-passing-example) for an example of how to use it\n\n## Installation\n\nUsing npm:\n\n```shell\nnpm install --save web-ext-msg-passing\n```\n\nor using yarn:\n\n```shell\nyarn add web-ext-msg-passing\n```\n\n## Usage\n\n### Basic Usage\n\nbackground:\n```javascript\nimport { listen, listenGroup, installListener } from \"web-ext-msg-passing\"\n\n// installListener is required if you want listen event\ninstallListener()\n\n// listen one event\nlisten(\"callApi\", () =\u003e {\n  return fetch(\"\u003cYOUR API URI\u003e\").then(res =\u003e res.json())\n})\n\n// listen multiple event\nlistenGroup({\n  callApi2(parameter) {\n    return fetch(\"\u003cYOUR API URI\u003e\", {\n      body: JSON.stringify(parameter)\n    }).then(res =\u003e res.json())\n  },\n  otherFn(parameter) {\n    // do something...\n  }\n})\n```\n\ncontent script or popup:\n```javascript\nimport { send } from \"web-ext-msg-passing\"\n\n// get api background response.\nawait send(\"callApi\")\n// get api background response with payload.\nawait send(\"callApi2\", {id: 123})\n// call background listener but not need response.\nsend(\"otherFn\", {id: 3})\n```\n\n### Send event to content script from background or popup\n\nbackground or popup:\n```javascript\nimport { sendToContent } from \"web-ext-msg-passing\"\n\nsendToContent(\"getContentHtml\").then(response =\u003e {\n  // response will get current page html\n})\n```\n\ncontent script:\n```javascript\nimport { installListener, listen } from \"web-ext-msg-passing\"\n\n// installListener is required if you want listen event\ninstallListener()\n\n// listen event\nlisten(\"getContentHtml\", () =\u003e document.documentElement.innerHTML)\n```\n\n## Typescript\n\nRefer to this [repository](https://github.com/ckaznable/web-ext-msg-passing-example/tree/main/src/typescript) for an example of how use in typescript","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckaznable%2Fweb-ext-msg-passing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fckaznable%2Fweb-ext-msg-passing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fckaznable%2Fweb-ext-msg-passing/lists"}