Skip to content

Releases: Aaronius/penpal

v6.2.2

06 Mar 21:58
Compare
Choose a tag to compare

Fixes #85 which is an issue where an error would occur under specific timing scenarios when the child iframe is removed from the DOM at about the same time it sends a SYN message. The error didn't cause operational issues, but would still be an uncaught error.

v6.2.1

14 Oct 04:22
Compare
Choose a tag to compare

Added some documentation to the readme regarding TypeScript usage.

v6.2.0

14 Oct 04:21
Compare
Choose a tag to compare

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

29 Jul 03:40
Compare
Choose a tag to compare

The methods object passed to connectToParent or connectToChild can now contain nested objects with function values. See #71 for more information.

v6.0.0

09 Jul 03:11
Compare
Choose a tag to compare

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

16 Oct 03:19
Compare
Choose a tag to compare
  • Exposed connection TypeScript type.
  • Fixed issue where connection would be automatically closed by Penpal if the iframe was located in a web component's shadow DOM.

Big thanks to @lpellegr for his work on these issues!

v5.2.1

06 Aug 03:49
Compare
Choose a tag to compare

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

30 Jul 19:32
Compare
Choose a tag to compare

Now publishing TypeScript typings alongside ES5-generated code.

v5.1.1

08 Jul 02:44
Compare
Choose a tag to compare

Removed add-module-exports babel plugin since it's unnecessary. This shouldn't have any effect on consumers.

v5.1.0

08 Jul 02:38
Compare
Choose a tag to compare

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.