Aaronius / penpal

A promise-based library for securely communicating with iframes via postMessage.
MIT License
381 stars 56 forks source link

Adding generic arguments and making build work cross platform. Fixes #47 #49

Closed marlon-tucker closed 4 years ago

marlon-tucker commented 4 years ago

Hello,

Turns out CallSender is used in a variety of places in the codebase and I didn't feel comfortable changing them all to be generic, plus it introduced issues where CallSender was instantiated.

So instead I have added the small restriction that the generic type parameter must extend from CallSender. To facilitate this I have re-exported that type from the main entry point. It doesn't affect the resulting js code in any way.

As the returned type should be just an interface shim to make sure the correct methods and types are being passed through, I don't foresee an issue with this but am open to suggestions.

I develop on windows so I've made the build process work cross platform as well (in theory).

Fixes #47

marlon-tucker commented 4 years ago

After sleeping on it, decided the need to extend CallSender didn't add anything for the user so I have removed that requirement.

Aaronius commented 4 years ago

I think that makes a lot of sense. Thanks @marlon-tucker!

Aaronius commented 4 years ago

Published in v5.0.1.