Skip to content

Commit

Permalink
Merge pull request #46 from xsolla/PAYMENTS-18763
Browse files Browse the repository at this point in the history
fix [PAYMENTS-18763]: fix mobile window close handler
  • Loading branch information
ymartyusheva authored Apr 17, 2024
2 parents 41ac22c + a4966c6 commit 0687d41
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.2.11
- [fix] Fixed mobile window close handler (PS 4)

## 1.2.10
- [feature] Add new event - error (PS 4)

Expand Down
18 changes: 10 additions & 8 deletions dist/widget.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/widget.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/widget.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xsolla-paystation-widget",
"version": "1.2.10",
"version": "1.2.11",
"description": "PayStation 3 Integration Widget",
"scripts": {
"build": "gulp build",
Expand Down
14 changes: 8 additions & 6 deletions src/childwindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ module.exports = (function () {

var that = this;
var addHandlers = function () {
that.on('close', function handleClose() {
function closeChildWindow() {
that.off('close', closeChildWindow)

if (timer) {
global.clearTimeout(timer);
}
if (that.childWindow) {
that.childWindow.close();
}
}

that.off('close', handleClose)
});
that.on('close', closeChildWindow);

// Cross-window communication
that.message = new PostMessage(that.childWindow);
Expand All @@ -58,9 +60,9 @@ module.exports = (function () {
that.message.on('status', function (event) {
that.triggerEvent('status', event.detail);
});
that.on('close', function handleClose() {
that.message.off();
that.off('close', handleClose);
that.message.on('close', function handleClose() {
closeChildWindow();
that.message.off('close', handleClose);
});
that.message.on('user-country', function (event) {
that.triggerEvent('user-country', event.detail);
Expand Down

0 comments on commit 0687d41

Please sign in to comment.