{"id":24557506,"url":"https://github.com/huang-x-h/iframe-postbox","last_synced_at":"2025-04-18T20:30:12.719Z","repository":{"id":57144903,"uuid":"72449976","full_name":"huang-x-h/iframe-postbox","owner":"huang-x-h","description":"A postmessage library for iframe communication","archived":false,"fork":false,"pushed_at":"2016-11-02T14:09:31.000Z","size":385,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T13:32:10.106Z","etag":null,"topics":["iframe","postmessage-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huang-x-h.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-31T15:27:33.000Z","updated_at":"2021-11-19T12:43:09.000Z","dependencies_parsed_at":"2022-08-26T13:11:46.571Z","dependency_job_id":null,"html_url":"https://github.com/huang-x-h/iframe-postbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huang-x-h%2Fiframe-postbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huang-x-h%2Fiframe-postbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huang-x-h%2Fiframe-postbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huang-x-h%2Fiframe-postbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huang-x-h","download_url":"https://codeload.github.com/huang-x-h/iframe-postbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249543296,"owners_count":21288703,"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-library"],"created_at":"2025-01-23T05:17:35.479Z","updated_at":"2025-04-18T20:30:12.689Z","avatar_url":"https://github.com/huang-x-h.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iframe-postbox\n\u003e A postmessage library inspire by [Postmate](https://github.com/dollarshaveclub/postmate)\n\nUse [`window.postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) method to communication in iframe\n\n## Install\n\nnpm install\n\n`$ npm i --save iframe-postbox`\n\nbrowser import\n\n`\u003cscript src=\"node_modules/iframe-postbox/postbox.js\u003e\u003c/script\u003e`\n\n## Usage\n\nparent.com\n\n```js\nvar handshake = new Postbox({\n  container: document.getElementById('some-div'), // Element to inject iframe into\n  url: 'http://child.com/page.html'\n});\n\nhandshake.then(function(child) {\n  child.get('name').then(function(value) {\n    alert(value)\n  };\n\n  child.on('some-event', function(data) {\n    console.log(data)\n  };\n};\n```\n\nchild.com/page.html\n\n```js\nvar handshake = new Postbox.Client({\n  name: 'iframe child'\n});\n\nhandshake.emit('some-event', 'Hello world')\n```\n\n## API\n\nSee https://huang-x-h.github.io/iframe-postbox/api/index.html\n\n## Browser support\n\n`postbox.js` support `IE9+/Chrome/Safari/Firefox`, `Promise` polyfill\n\n`postbox.jquery.js` supoort `IE8+/Chrome/Safari/Firefox`, base on `jquery` (use `Deferred` instead of 'Promise')\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuang-x-h%2Fiframe-postbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuang-x-h%2Fiframe-postbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuang-x-h%2Fiframe-postbox/lists"}