Releases: Aaronius/penpal
v6.2.2
v6.2.1
v6.2.0
Added support for a wildcard as a value for childOrigin
. This allows the parent to communicate within any child origin.
Thanks @KutnerUri for the contribution!
v6.1.0
v6.0.0
With a major release comes breaking changes. Here's what you need to know:
NotInIframe error removed
What
The NotInIframe
error, which was thrown if connectToParent
was called from outside of an iframe, has been removed. Fixes #61.
Why
Previously, if a call was made to connectToParent
from outside of an iframe, Penpal would throw an error with the NotInIframe
error code. While this was a nice idea, it didn't play well with Cypress. Cypress by default attempts to "modify obstructive code". In other words, if any JavaScript attempts to perform framebusting, Cypress tries to modify the code since such techniques prevent Cypress from working properly. As it turns out, Penpal's check to see if it was running inside of an iframe was not performing framebusting, but Cypress would see it as obstructive code anyway and attempt to modify it, which would actually break testing with Cypress + Penpal entirely. The workaround wasn't great and, given that Penpal's check wasn't providing a lot of value, I decided it would be in consumers' interest to remove the check.
ConnectionDestroyed error reduced in scope
What
Previously, Penpal would reject the connection promise with an error containing the ConnectionDestroyed
error code if the consumer called connection.destroy
before a connection was made. Fixes #51.
Why
When a consumer calls destroy
, they are intentionally destroying the connection and shouldn't be forced to handle a rejected promise as a consequence. It's not an exceptional use case, so it does not merit a rejection. This change should lower development burden, as described in #51.
The ConnectionDestroyed
error is still thrown if a child or parent method is called after a connection has been destroyed.
Exported types
What
This is not a breaking change. The following TypeScript types are now exported as named exports: Connection
, AsyncMethodReturns
, CallSender
, Methods
, and PenpalError
types. Fixes #67.
Why
TypeScript types could previously (and still can) be imported through a child path as follows:
import { Connection } from 'penpal/lib/types';
but that made them less discoverable and the fact that they could be relied on was only implicit. They are now named exports on the top-level module, so they can now be imported as follows:
import { Connection } from 'penpal';
v5.3.0
v5.2.1
Rather than creating copies of the typescript declarations for es5, I switched to leveraging the types
field in package.json
to point to the typings that were generated when the typescript files were compiled to es6. Besides reducing the need for duplicate declarations, it's also advised by the TypeScript documentation.
v5.2.0
v5.1.1
v5.1.0
Prior to v5.0.0, I had transpiled Penpal code to es5 before packaging for npm. Starting with v5.0.0, I decided to only bundle for es6 with the hope that bundler support for es6 would be strong enough that packaging es5 would be unnecessary and consumers could configure their bundler to transpile penpal back to es5 if necessary. Due to popular demand and because bundlers can be a pain to configure to transpile penpal to es5, I added back transpilation to es5.
The npm package now includes both es6 and es5 code. If the consumer's bundler is capable of bundling es6 code, it should use the es6 code automatically. If it's not capable of bundling es6 code, then Penpal's es5 code will be used automatically instead.
This should not affect the runtime behavior of Penpal in any way.