{"id":23532632,"url":"https://github.com/outbrain-inc/postit","last_synced_at":"2025-04-22T22:41:19.154Z","repository":{"id":34158354,"uuid":"37998608","full_name":"outbrain-inc/postit","owner":"outbrain-inc","description":"An elegant wrapper for postMessage","archived":false,"fork":false,"pushed_at":"2023-03-31T12:26:04.000Z","size":219,"stargazers_count":53,"open_issues_count":0,"forks_count":7,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-18T22:51:51.815Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/outbrain-inc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-24T17:06:52.000Z","updated_at":"2024-11-11T18:38:51.000Z","dependencies_parsed_at":"2024-11-12T17:02:41.042Z","dependency_job_id":"0c2cb3a2-7233-436c-a706-83b80e2a0b31","html_url":"https://github.com/outbrain-inc/postit","commit_stats":null,"previous_names":["outbrain-inc/postit","outbrain/postit"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fpostit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fpostit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fpostit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/outbrain-inc%2Fpostit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/outbrain-inc","download_url":"https://codeload.github.com/outbrain-inc/postit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337277,"owners_count":21414092,"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-12-25T23:12:08.908Z","updated_at":"2025-04-22T22:41:19.125Z","avatar_url":"https://github.com/outbrain-inc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostIt\n\nAn elegant wrapper for [`postMessage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage).\n\n![Unit Test Coverage](https://cdn.rawgit.com/outbrain/postit/master/coverage.svg)\n[![Known Vulnerabilities](https://snyk.io/test/npm/postit-js/badge.svg)](https://snyk.io/test/npm/postit-js)\n\n## Installation\n\nInstall `postit-js` as a dependency.\n\n```bash\n$ npm install --save postit-js\n```\n\n## Run PostIt in a Browser\n\n### HTML Script Element\n\n```html\n\u003cscript src=\"path/to/postit.js\"\u003e\u003c/script\u003e\n```\n\n### CommonJS Browser Shimming (Browserify and Other Flavors)\n\n```js\nvar PostIt = require('postit');\n```\n\n## API Documentation\n\n### .add(id) =\u003e `object`\n\nCreates and manages a `PostIt` instance (`id`).\n\n| Param |   Type   |\n|:-----:|:--------:|\n| id    | `string` |\n\n```javascript\nPostIt.add('baz');\n```\n\n### .remove(id) =\u003e `object`\n\nRemoves a `PostIt` instance (`id`).\n\n| Param |   Type   |\n|:-----:|:--------:|\n| id    | `string` |\n\n```javascript\nPostIt.remove('baz');\n```\n\n### .removeAll() =\u003e `object`\n\nRemoves all `PostIt` instances.\n\n```javascript\nPostIt.removeAll();\n```\n\n### .size() =\u003e `number`\n\nReturns the length of all `PostIt` instances.\n\n```javascript\nPostIt.size();\n```\n\n### .get(id) =\u003e `object` | `void`\n\nGets a `PostIt` instance (`id`).\n\n| Param |   Type   |\n|:-----:|:--------:|\n| id    | `string` |\n\n```javascript\nPostIt.get('baz');\n```\n\n### .getAll() =\u003e `object`\n\nGets all `PostIt` instances.\n\n```javascript\nPostIt.getAll();\n```\n\n### .on(id, event, listener) =\u003e `object`\n\nRegisters a `listener` to a `PostIt` instance (`id`), for a given `event`.\n\n|   Param  |    Type    |\n|:--------:|:----------:|\n| id       | `string`   |\n| event    | `string`   |\n| listener | `function` |\n\n```javascript\nPostIt.on('baz', 'bar', function(event) {\n\t// ...\n});\n```\n\n### .off(id, event[, listener]) =\u003e `object`\n\n- If a `listener` is not provided, then unregister all listeners from a `PostIt` instance (`id`), for a given `event`.\n- If a `listener` is provided, then unregister a `listener` from a `PostIt` instance (`id`), for a given `event`.\n\n|   Param    |    Type    |\n|:----------:|:----------:|\n| id         | `string`   |\n| event      | `string`   |\n| [listener] | `function` |\n\n```javascript\nPostIt.off('baz', 'bar');\n\nfunction bazBar() {}\n\nPostIt.off('baz', 'bar', bazBar);\n```\n\n### .emit(id, event, target, message, origin) =\u003e `object`\n\n- If `event` is an asterisk (\\*), then emit an `event` to all listeners registered to a `PostIt` instance (`id`), for all given `event`s.\n- If `event` is not an asterisk (\\*), then emit an `event` to all listeners registered to a `PostIt` instance (`id`), for a given `event`.\n\n|  Param  |            Type           |\n|:-------:|:-------------------------:|\n| id      | `string`                  |\n| event   | `string`                  |\n| target  | `object`                  |\n| message | `string` `array` `object` |\n| origin  | `string`                  |\n\n```javascript\nPostIt.emit('baz', 'bar', window.parent.opener, { baz: 'bar' }, 'http://www.baz.com');\n```\n\n### .openWindow(url, name, options) =\u003e `object`\n\nLoads a resource into a new browsing context (`window`).\n\n|      Param     |   Type   |\n|:--------------:|:--------:|\n| url            | `string` |\n| name           | `string` |\n| options        | `object` |\n| options.width  | `number` |\n| options.height | `number` |\n\nSee: [window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window/open) for more options.\n\n```javascript\nPostIt.openWindow('http://www.foo.com', 'foo', {\n\twidth: 700,\n\theight: 500\n});\n```\n\n## Example\n\n[Example](example)\n\n## Contributing\n\n[Contributing](CONTRIBUTING.md)\n\n## Changelog\n\n[Changelog](CHANGELOG.md)\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutbrain-inc%2Fpostit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foutbrain-inc%2Fpostit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foutbrain-inc%2Fpostit/lists"}