secondstreet / talker.js

A tiny, promise-based library for cross-origin communication between frames and windows.
http://drive.secondstreet.com/introducing-talker/
MIT License
33 stars 10 forks source link

Add an option to reject a message #3

Open michalstocki opened 8 years ago

michalstocki commented 8 years ago

Currently we can only respond to a message, remotely resolving a promise awaiting in the other frame. We'll find it useful if we could also reject a message like this:

talker.onMessage = function(message) {
  message.reject(reason);
};

Then, the reason string will be send to a talker in other window and the awaiting promise will be rejected with the reason.

Kerrick commented 8 years ago

Sounds like a great feature! PRs accepted :)