Comparing version 2.1.0 to 2.2.0
@@ -5,2 +5,10 @@ # Change Log | ||
## [2.2.0] - 2016-02-01 | ||
### Added | ||
- Adds destroy method to Postis channel | ||
## [2.1.1] - 2016-01-28 | ||
### Fixed | ||
- Check that targetWindow has postMessage property on send | ||
## [2.1.0] - 2016-01-20 | ||
@@ -7,0 +15,0 @@ ### Added |
{ | ||
"name": "postis", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Lightweight wrapper around the PostMessage API", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -60,1 +60,14 @@ # Postis | ||
``` | ||
## Release | ||
New releases are prepared in master after merging the PRs. Please include a meaningful changelog entry in PR. | ||
Write a new `CHANGELOG.md` entry before running built-in [npm version](https://docs.npmjs.com/cli/version) bump and add the change to next commit. | ||
``` | ||
npm version <major | minor | patch> | ||
git push --tags | ||
``` | ||
`npm version` should include added changelog entry in the commit. Remember to push changes. |
@@ -10,6 +10,8 @@ function Postis(options) { | ||
var readyMethod = "__ready__"; | ||
var readynessCheck; | ||
windowForEventListening.addEventListener("message", function (event) { | ||
var listener = function(event) { | ||
var data; | ||
try { | ||
var data = JSON.parse(event.data); | ||
data = JSON.parse(event.data); | ||
} catch (e) { | ||
@@ -30,4 +32,6 @@ return; | ||
} | ||
}, false); | ||
}; | ||
windowForEventListening.addEventListener("message", listener, false); | ||
var postis = { | ||
@@ -53,3 +57,3 @@ listen: function (method, callback) { | ||
if (ready || opts.method === readyMethod) { | ||
if ((ready || opts.method === readyMethod) && (targetWindow && typeof targetWindow.postMessage === "function")) { | ||
targetWindow.postMessage(JSON.stringify({ | ||
@@ -72,2 +76,11 @@ postis: true, | ||
} | ||
}, | ||
destroy: function (callback) { | ||
clearInterval(readynessCheck); | ||
ready = false; | ||
if (windowForEventListening && typeof windowForEventListening.removeEventListener === "function") { | ||
windowForEventListening.removeEventListener("message", listener); | ||
} | ||
callback && callback(); | ||
} | ||
@@ -78,3 +91,3 @@ }; | ||
var readynessCheck = setInterval(function () { | ||
readynessCheck = setInterval(function () { | ||
postis.send({ | ||
@@ -81,0 +94,0 @@ method: readyMethod, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
7867
121
73