braintree-web
Version:
A suite of tools for integrating Braintree in the browser
42 lines (31 loc) • 768 B
JavaScript
var composeOptions = require("./compose-options");
function noop() {}
function Popup(options) {
this._frame = null;
this._options = options || {};
}
Popup.prototype.initialize = noop;
Popup.prototype.open = function () {
this._frame = window.open(
this._options.openFrameUrl,
this._options.name,
composeOptions(this._options)
);
};
Popup.prototype.focus = function () {
this._frame.focus();
};
Popup.prototype.close = function () {
if (this._frame.closed) {
return;
}
this._frame.close();
};
Popup.prototype.isClosed = function () {
return !this._frame || Boolean(this._frame.closed);
};
Popup.prototype.redirect = function (redirectUrl) {
this._frame.location.href = redirectUrl;
};
module.exports = Popup;
;