Skip to content

Commit

Permalink
Distinguish between dialog being closed remotely and by user (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight authored Oct 24, 2024
1 parent 9c53496 commit 0bcac31
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
8 changes: 8 additions & 0 deletions examples/test-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# test-app

## 1.0.19

### Patch Changes

- Updated dependencies
- @parcnet-js/app-connector@1.1.7
- @parcnet-js/app-connector-react@1.0.2

## 1.0.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/test-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "test-app",
"version": "1.0.18",
"version": "1.0.19",
"private": true,
"type": "module",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions packages/app-connector-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @parcnet-js/app-connector-react

## 1.0.2

### Patch Changes

- Updated dependencies
- @parcnet-js/app-connector@1.1.7

## 1.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/app-connector-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parcnet-js/app-connector-react",
"version": "1.0.1",
"version": "1.0.2",
"license": "GPL-3.0-or-later",
"type": "module",
"main": "dist/index.cjs",
Expand Down
6 changes: 6 additions & 0 deletions packages/app-connector/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @parcnet-js/app-connector

## 1.1.7

### Patch Changes

- Distinguish between dialog closed by client and by user interaction

## 1.1.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/app-connector/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parcnet-js/app-connector",
"version": "1.1.6",
"version": "1.1.7",
"license": "GPL-3.0-or-later",
"type": "module",
"main": "dist/index.cjs",
Expand Down
8 changes: 5 additions & 3 deletions packages/app-connector/src/adapters/iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DialogControllerImpl implements DialogController {
}

public close(): void {
this.#dialog.close();
this.#dialog.close("REMOTELY_CLOSED");
}
}

Expand Down Expand Up @@ -77,8 +77,10 @@ export function connect(
}
});

dialog.addEventListener("close", () => {
emitter.emit("close");
dialog.addEventListener("close", (ev: Event) => {
if ((ev.target as HTMLDialogElement)?.returnValue !== "REMOTELY_CLOSED") {
emitter.emit("close");
}
});

// Add a backdrop to the dialog
Expand Down

0 comments on commit 0bcac31

Please sign in to comment.