{"id":27010424,"url":"https://github.com/friedemannsommer/typescript-postmessagehandler","last_synced_at":"2025-04-04T11:05:03.049Z","repository":{"id":49615728,"uuid":"54546294","full_name":"friedemannsommer/typescript-postmessagehandler","owner":"friedemannsommer","description":"Simply implements postMessage in Typescript","archived":false,"fork":false,"pushed_at":"2025-03-21T00:46:03.000Z","size":1609,"stargazers_count":7,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T16:55:49.614Z","etag":null,"topics":["iframe","postmessage","typescript"],"latest_commit_sha":null,"homepage":"http://friedemannsommer.github.io/typescript-postmessagehandler/","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/friedemannsommer.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-23T09:18:31.000Z","updated_at":"2025-03-14T18:16:46.000Z","dependencies_parsed_at":"2022-08-20T12:50:34.935Z","dependency_job_id":"9515490b-6944-4952-a728-182264e57fea","html_url":"https://github.com/friedemannsommer/typescript-postmessagehandler","commit_stats":{"total_commits":306,"total_committers":8,"mean_commits":38.25,"dds":"0.47058823529411764","last_synced_commit":"cdb3620615615d95500b2daa80b756506b82cf1f"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedemannsommer%2Ftypescript-postmessagehandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedemannsommer%2Ftypescript-postmessagehandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedemannsommer%2Ftypescript-postmessagehandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/friedemannsommer%2Ftypescript-postmessagehandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/friedemannsommer","download_url":"https://codeload.github.com/friedemannsommer/typescript-postmessagehandler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247002127,"owners_count":20867403,"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":["iframe","postmessage","typescript"],"created_at":"2025-04-04T11:05:02.527Z","updated_at":"2025-04-04T11:05:03.039Z","avatar_url":"https://github.com/friedemannsommer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typescript PostMessage\n\nSimply implements postMessage in Typescript\n\n## Documentation\n\nYou can find the API documentation\nhere: [friedemannsommer.github.io/typescript-postmessagehandler](https://friedemannsommer.github.io/typescript-postmessagehandler/)\n\n## Compatibility\n\n**NO** fallback for older Browsers!\n\nPartial (IFrames)\n\n* IE8-9\n\nFull (IFrames, Windows, Tabs)\n\n* IE10+\n* Edge 12+\n* Firefox 3+\n* Chrome 4+\n* Safari 4+\n* Opera 10.1+\n\nSource: [Can I use](https://caniuse.com/mdn-api_window_postmessage)\n\n## Example\n\n### Sender\n\n```typescript\n/**\n * https://app.example.com\n */\nimport PostMessageHandler from 'typescript-postmessagehandler';\n\n// in this example we use a IFrame to communicate with\nconst secret = 'my-secret-key';\nlet iFrame: HTMLIFrameElement = document.createElement('iframe');\n\niFrame.src = 'https://example.com/#' + secret;\n\ndocument.appendChild(iFrame);\n\n// instantiate PostMessageHandler\nconst messageHandler = new PostMessageHandler(secret, iFrame.contentWindow, 'https://example.com');\n\n// send a message\nmessageHandler.send('example data', 1337, ['array', 'values'], {key: 'value'});\n```\n\n### Receiver\n\n```typescript\n/**\n * https://example.com\n */\nimport PostMessageHandler from 'typescript-postmessagehandler';\n\n// instantiate PostMessageHandler\nconst messageHandler = new PostMessageHandler(window.location.hash.slice(1), window.parent, document.referrer);\n\n// create PostMessage Listener\nfunction handlePostMessage(stringValue: string, numberValue: number, arrayValue: Array\u003cstring\u003e, objectValue: Object) {\n    // do what ever you want with your data :)\n}\n\n// subscribe to PostMessages\nmessageHandler.subscribe(handlePostMessage);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedemannsommer%2Ftypescript-postmessagehandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffriedemannsommer%2Ftypescript-postmessagehandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffriedemannsommer%2Ftypescript-postmessagehandler/lists"}