{"id":27637042,"url":"https://github.com/thalesrc/hermes","last_synced_at":"2025-04-23T21:16:00.173Z","repository":{"id":57165770,"uuid":"167409874","full_name":"thalesrc/hermes","owner":"thalesrc","description":"Javascript messaging library","archived":false,"fork":false,"pushed_at":"2023-11-29T16:17:17.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T21:15:49.691Z","etag":null,"topics":["chrome","chrome-extension","extension","hermes","library","messaging","typescript"],"latest_commit_sha":null,"homepage":null,"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/thalesrc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-24T17:42:55.000Z","updated_at":"2022-10-21T15:12:33.000Z","dependencies_parsed_at":"2023-11-29T16:51:14.666Z","dependency_job_id":"bfc50218-19d7-4f5b-807a-d786cab2d263","html_url":"https://github.com/thalesrc/hermes","commit_stats":null,"previous_names":[],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thalesrc%2Fhermes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thalesrc%2Fhermes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thalesrc%2Fhermes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thalesrc%2Fhermes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thalesrc","download_url":"https://codeload.github.com/thalesrc/hermes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514774,"owners_count":21443219,"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":["chrome","chrome-extension","extension","hermes","library","messaging","typescript"],"created_at":"2025-04-23T21:15:59.673Z","updated_at":"2025-04-23T21:16:00.164Z","avatar_url":"https://github.com/thalesrc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hermes\n![publish build](https://github.com/thalesrc/hermes/workflows/Npm%20Package/badge.svg)\n[![npm](https://img.shields.io/npm/v/@thalesrc/hermes.svg)](https://www.npmjs.com/package/@thalesrc/hermes)\n[![npm](https://img.shields.io/npm/dw/@thalesrc/hermes.svg)](https://www.npmjs.com/package/@thalesrc/hermes)\n[![codecov](https://codecov.io/gh/thalesrc/hermes/branch/master/graph/badge.svg)](https://codecov.io/gh/thalesrc/hermes)\n[![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://www.typescriptlang.org/)\n\nJavascript messaging library\n\n## Installation\n`npm i @thalesrc/hermes` or `yarn add @thalesrc/hermes`\n\n## Usage\n\nThe main concept is sending messages via `MessageClient`'s and answering them via `MessageHost`'s.\n\n------------------------------------------------------------------\n\n### Iframe\n\nSend and recieve messages accross iframes and parent windows\n\n```typescript\n// inside iframe\nimport { IframeMessageClient, Request } from '@thalesrc/hermes/iframe';\n\nclass MessageSenderService extends IframeMessageClient {\n  @Request('hello')\n  public sayHello(name: string): Observable\u003cstring\u003e {\n    return null;\n  }\n}\n\nconst service = new MessageSenderService();\n\nservice.sayHello('John').subscribe(message =\u003e {\n  console.log(message);\n});\n\n// 'Hi John, here are some data for you'\n// 'Thales Rocks!!'\n\n```\n\n```typescript\n// inside parent window\nimport { IframeMessageHost, Listen, UpcomingMessage } from '@thalesrc/hermes/iframe';\nimport { of } from 'rxjs';\n\nclass MessageListenerService extends IframeMessageHost {\n  @Listen('hello')\n  public listenHello({data, sender}: UpcomingMessage): Observable\u003cstring\u003e {\n    return of(\n      'Hi ' + data + ', here is some data for you',\n      'Thales Rocks!!'\n    );\n  }\n}\n\nconst listener = new MessageListener();\n\n```\n\n------------------------------------------------------------------\n\n### Chrome Extensions\n\nSend and recieve messages accross tabs, background-scripts, content-scripts etc.\n\n```typescript\n// content-script or a page etc.\nimport { ChromeMessageClient, Request } from '@thalesrc/hermes/chrome';\n\nclass MessageSenderService extends ChromeMessageClient {\n  @Request('hello')\n  public sayHello(name: string): Observable\u003cstring\u003e {\n    return null;\n  }\n}\n\nconst service = new MessageSenderService();\n\nservice.sayHello('John').subscribe(message =\u003e {\n  console.log(message);\n});\n\n// 'Hi John, here are some data for you'\n// 'Thales Rocks!!'\n\n```\n\n```typescript\n// background-script etc.\nimport { ChromeMessageHost, Listen } from '@thalesrc/hermes/chrome';\nimport { of } from 'rxjs';\n\nclass MessageListenerService extends ChromeMessageHost {\n  @Listen('hello')\n  public listenHello(name: string): Observable\u003cstring\u003e {\n    return of(\n      'Hi ' + name + ', here is some data for you',\n      'Thales Rocks!!'\n    );\n  }\n}\n\nconst listener = new MessageListener();\n\n```\n\n------------------------------------------------------------------\n\n### Workers\n\nImplemented but not documented yet\n\n------------------------------------------------------------------\n\n### Broadcast\n\nImplemented but not documented yet","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthalesrc%2Fhermes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthalesrc%2Fhermes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthalesrc%2Fhermes/lists"}