- Fix a bug with not being able to remove handlers when targetFrames are used.
-
Update (sub-)dependencies
- axios to 1.7.7
- body-parse to 1.20.3
- cookie to 0.7.1
- elliptic to 6.6.1
- micromatch to 4.0.8
- send to 0.19.0
- serve-static to 1.16.2
-
Update dev dependencies:
- chromedriver to v131.0.1
- express to 4.20.1
- Update @braintree/uuid to v1.0.0
- Update dev dependencies:
- chromedriver to v125.0.3
- ejs to v3.1.10
- express to v4.19.2
- gulp to v5.0.0
- Update package-lock file version from 1 to 3
- Minor dev dependency updates
-
Update to node v18
-
Dev Dependency Updates
- Update to TypeScript 5
- Update Chromedriver to 118
- Fix circular dependency issue (Issue #97)
- Add ability to target specific frames with
targetFrames
configuration - Add
addTargetFrame
method to add additional frames totargetFrames
- Fix issue where framebus could not be used with server side rendering
- Fix issue where Internet Explorer would error because Promise is not defined
- Fix issue where emitting to new window could cause an infinite loop (closes #41, thanks @blutorange)
- Add
emitAsPromise
as convenience method when waiting for replies fromemit
calls - Add
setPromise
static method for easy polyfilling environments that do not support promises
-
Allow scoping to a specific channel for events
var bus = new Framebus({ channel: "some-unique-identifier-used-on-both-the-parent-and-child-pages", });
-
Add
verifyDomain
config to scope messages to specific domainsvar bus = new Framebus({ verifyDomain: function (url) { // only listens for events emitted from `https://parent-url.example.com` and `https://my-domain.example.com` return url.indexOf("https://my-domain.example.com"); }, });
-
Add
teardown
method for easy cleanup
Breaking Changes
-
Instantiate new instances of framebus
// v4 var bus = require("framebus"); bus.on(/* args */); bus.emit(/* args */); // v5 var Framebus = require("framebus"); var bus = new Framebus(); bus.on(/* args */); bus.emit(/* args */);
-
Instantiating a framebus with
target
method with anorigin
param now requires an options object (same object that is used to instantiate the instance)// v4 var bus = require("framebus"); var anotherBus = bus.target("example.com"); // v5 var Framebus = require("framebus"); var bus = Framebus.target({ origin: "example.com", }); var anotherBus = bus.target({ origin: "example.com", });
- Fixup Framebus typing for Typescript integrations
- Use
@braintree/uuid
package for uuid generation - Update typescript to v4
- Fix issue where rollup bundlers could not import framebus (see braintree-web#504)
- Fix issue where framebus could not be used with server side rendering
Breaking Changes
- Drop support for IE < 9
- Drop support for using methods standalone without using the bus
- Drop
publish
,pub
, andtrigger
methods. Useemit
- Drop
subscribe
andsub
methods. Useon
- Drop
unsubscribe
andunsub
methods. Useoff
- Drop support for passing multiple arguments to
emit
, not it only supports passingdata
andreply
-
Fix issue where framebus would error when trying to reply to a non-existent window/frame
-
Fix issue where broadcasts to frames would fail if parent page has overwritten the window.length variable
BREAKING CHANGES
-
Module is now CommonJS only, and must be used with npm with a build tool (Browserify, Webpack, etc)
-
Bower support dropped
-
Fall back to
window.self
whenwindow.top
is undefined in old versions of IE. -
Corrects a regression introduced in 2.0.6 that prevented CommonJS runtimes from working.
-
framebus can be required (but not executed) from Node.js® environments.
-
Only traverse to
opener
from the top-level frame -
Avoid exceptions while broadcasting events
-
Do not infinitely recurse when
window.opener === window
[unpublished]
-
Do not throw exceptions
window.opener
existed but has already closed. -
Do not throw exceptions when a
frame.postMessage
is denied. -
Exceptions are no longer thrown when
publish
,subscribe
orunsubscribe
were invoked directly.var publish = framebus.publish; publish("event");
-
Breaking change: use of
origin
as a parameter forpublish
,subscribe
andunsubscribe
has been moved to the chaining-functiontarget(origin)
-
Added feature: events can be published with multiple arguments. If the last argument is a function, it is treated as a callback that subscribers can call.
-
Added feature:
include(popup)
adds popups to the listing of frames to be messaged. -
Added feature:
window.opener
will now be included in framebus messaging, if available. -
Initial release