{"id":18096224,"url":"https://github.com/bredele/post","last_synced_at":"2025-04-13T10:05:15.548Z","repository":{"id":14443751,"uuid":"17155273","full_name":"bredele/post","owner":"bredele","description":"Emitter-like component that enables safe cross origin communication.","archived":false,"fork":false,"pushed_at":"2014-02-25T07:57:15.000Z","size":432,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T03:32:04.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/bredele.png","metadata":{"files":{"readme":"README.md","changelog":"History.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":"2014-02-24T23:59:17.000Z","updated_at":"2019-07-22T02:09:31.000Z","dependencies_parsed_at":"2022-09-16T00:52:19.223Z","dependency_job_id":null,"html_url":"https://github.com/bredele/post","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/bredele%2Fpost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fpost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fpost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bredele%2Fpost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bredele","download_url":"https://codeload.github.com/bredele/post/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695438,"owners_count":21146954,"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":[],"created_at":"2024-10-31T19:13:04.858Z","updated_at":"2025-04-13T10:05:15.511Z","avatar_url":"https://github.com/bredele.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"post\n====\n\nEmitter-like component that enables safe cross origin communication. Its nice and clean API makes it easy to send messages to workers, extensions, iframes or cross origin web apps.\n\n## Installation\n\ncomponent:\n\n    $ component install bredele/post\n\nbrowserify (nodejs):\n\n    $ npm install post\n\nstandalone:\n\n```html\n\u003cscript src=\"post.js\"\u003e\u003c/script\u003e\n```\n\n`Post` support all mainstream browsers and IE.\n\n## API\n\n`Post` inherits from '[Emitter](http://github.com/component/emitter)' and can be used as a regular \nemitter or post messages safely to a cross origin.\n\n### Post(obj)\n\n  `Post` instance:\n\n```js\nvar Post = require('post');\nvar post = new Post();\npost.emit('something');\n```\n\n### .emit(event, ...)\n\n   Emit an `event` with variable option args.\n\nSend a message locally:\n\n```js\npost.emit('message');\n```\n\nSend a message to a cross origin (`default` is window origin):\n\n```js\npost.emit('message')(); //same window origin\n\npost.emit('message')('http://otherdomain.org'); //cross origin\n```\n\n### .on(event, fn)\n\n   Register and execute handler `fn` when `event` is received \n   from same or cross origin.\n\n```js\npost.on('message', function() {\n  //do something\n});\n```\n\n### .off(event, fn)\n\n  * Pass `event` and `fn` to remove a listener.\n  * Pass `event` to remove all listeners on that event.\n  * Pass nothing to remove all listeners on all events.\n\n\n### .dispose()\n\n  Memory safety (remove cross origin listeners).\n\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Olivier Wietrich \u003colivier.wietrich@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbredele%2Fpost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbredele%2Fpost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbredele%2Fpost/lists"}