{"id":51595928,"url":"https://github.com/petarjs/ng-post-message","last_synced_at":"2026-07-11T18:42:38.897Z","repository":{"id":58234959,"uuid":"43359707","full_name":"petarjs/ng-post-message","owner":"petarjs","description":"AngularJS Post Message API wrapper","archived":false,"fork":false,"pushed_at":"2016-03-17T12:47:29.000Z","size":530,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T07:43:39.852Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://petarslovic.github.io/ng-post-message/","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/petarjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-09-29T10:02:35.000Z","updated_at":"2016-07-05T02:31:25.000Z","dependencies_parsed_at":"2022-08-31T09:21:12.031Z","dependency_job_id":null,"html_url":"https://github.com/petarjs/ng-post-message","commit_stats":null,"previous_names":["petarslovic/ng-post-message"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/petarjs/ng-post-message","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petarjs%2Fng-post-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petarjs%2Fng-post-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petarjs%2Fng-post-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petarjs%2Fng-post-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petarjs","download_url":"https://codeload.github.com/petarjs/ng-post-message/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petarjs%2Fng-post-message/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35372639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2026-07-11T18:42:38.232Z","updated_at":"2026-07-11T18:42:38.882Z","avatar_url":"https://github.com/petarjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AngularJS Post Message API Wrapper\r\n\r\nAngularJS Post Message API Wrapper.\r\nDeveloped for communication between two Angular apps, but can be used with non-angular apps as well.\r\n\r\n## Demo\r\nhttp://petarslovic.github.io/ng-post-message/\r\n\r\n## Dependencies\r\n- required:\r\n\tlodash\r\n\r\nSee `bower.json` and `index.html` in the `gh-pages` branch for a full list / more details\r\n\r\n## Install\r\n### Get the files\r\n\tBower\r\n\t\tadd `\"ng-post-message\": \"latest\"` to your `bower.json` file then run `bower install` OR run `bower install ng-post-message`\r\n\r\n### Include the files in your app\r\n  `post-message.min.js`\r\n\r\n### Include the module in angular\r\n  i.e. in `app.js` - `petarslovic.ng-post-message`\r\n\r\nSee the `gh-pages` branch, files `bower.json` and `index.html` for a full example.\r\n\r\n\r\n## Documentation\r\n\r\n### Configuration\r\n\r\nTo configure ng-post-message, inject it in the config phase like so:\r\n```\r\n  angular\r\n    .module('your-module')\r\n    .config(function(PostMessageProvider) {\r\n      PostMessageProvider.setAllowedDomains(['http://petarslovic.github.io']);\r\n    });\r\n```\r\n\r\n- **PostMessageProvider.setAllowedDomains(array)**\r\nSet the list of domains that your app can communicate with.\r\nThis list will be checked when your app receives a message.\r\n\r\n- **PostMessageProvider.debug(boolean)**\r\nTurn debug messages on or off.\r\n\r\n### API\r\n\r\n- **PostMessage.on(*messageName*, *callback*)**\r\nRegisters message listeners.\r\nMessage name is like an event name, and callback will be executed when the message arrives.\r\nWhen your callback is invoked, it will be provided the original event and message data as parameters in that order.\r\nMessage data is an object containing `messageName` and `data`.\r\n\r\n```\r\n  var offSomeEvent = PostMessage.on('some-event', function(event, data) {\r\n    console.log(event, data);\r\n    vm.message = data;\r\n  });\r\n```\r\n\r\nThe `PostMessage.on` method returns a deregister function that you can call to deregister that listener.\r\nFor example, you would deregister a listener when a scope is destroyed (i.e. state changed).\r\n\r\n```\r\n  $scope.$on('$destroy', offSomeEvent);\r\n```\r\n\r\n- **PostMessage.send(*messageName*, *data*, *iframeName*, *domain*)**\r\nSends a message with name `messageName` and data `data` to iframe with `[name=\"iframeName\"]` that is located on the domain `domain`.\r\nIf you provide null as an `iframeName` the message will be sent to `window.parent` (for sending messages from an iframe to parent window).\r\nIf you don't provide `domain` as a parameter, `'*'` will be used.\r\n\r\n```\r\n  PostMessage.send('some-event', {\r\n    some: 'data'\r\n  }, 'myIframeName', 'http://petarslovic.github.io');\r\n```\r\n\r\n## Development\r\n\r\n1. `git checkout gh-pages`\r\n\t1. run `npm install \u0026\u0026 bower install`\r\n\t2. write your code then run `grunt`\r\n\t3. git commit your changes\r\n2. copy over core files (.js and .css/.less for directives) to master branch\r\n\t1. `git checkout master`\r\n\t2. `git checkout gh-pages post-message.js post-message.min.js`\r\n3. update README, CHANGELOG, bower.json, and do any other final polishing to prepare for publishing\r\n\t1. git commit changes\r\n\t2. git tag with the version number, i.e. `git tag v1.0.0`\r\n4. create github repo and push\r\n\t1. [if remote does not already exist or is incorrect] `git remote add origin [github url]`\r\n\t2. `git push origin master --tags` (want to push master branch first so it is the default on github)\r\n\t3. `git checkout gh-pages`\r\n\t4. `git push origin gh-pages`\r\n5. (optional) register bower component\r\n\t1. `bower register ng-post-message [git repo url]`\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetarjs%2Fng-post-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetarjs%2Fng-post-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetarjs%2Fng-post-message/lists"}