Skip to content

Commit

Permalink
Merge pull request #136 from SpringRoll/feature/pause-plugin-update
Browse files Browse the repository at this point in the history
Clean up unnecessary focus management
  • Loading branch information
902seanryan authored Nov 1, 2022
2 parents d63da1a + e9d9dda commit 941c931
Show file tree
Hide file tree
Showing 9 changed files with 12,290 additions and 3,340 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.4.0] unreleased
## [2.4.1] unreleased

### Fixed

- Fixed PausePlugin focus management so game pauses/unpauses properly on load

## [2.4.0] 2022-07-05

## Added

Expand Down
3 changes: 2 additions & 1 deletion dist/SpringRoll-Container-umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/SpringRoll-Container-umd.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/index.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

8,253 changes: 8,220 additions & 33 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "springroll-container",
"version": "2.3.4",
"version": "2.4.1",
"description": "The iframe controller for interacting with SpringRoll applications",
"main": "./dist/index.js",
"license": "MIT",
Expand Down
8 changes: 2 additions & 6 deletions src/plugins/PausePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export class PausePlugin extends ButtonPlugin {
this._paused = paused;

this.client.send(PausePlugin.pauseKey, paused);
this.client.trigger(paused ? 'paused' : 'resumed', {
paused: paused
});
this.client.trigger(paused ? 'paused' : 'resumed', { paused });

for (let i = 0, l = this._pauseButton.length; i < l; i++) {
this._pauseButton[i].button.classList.remove('unpaused');
Expand Down Expand Up @@ -118,7 +116,6 @@ export class PausePlugin extends ButtonPlugin {
return;
}

this._containerBlurred = true;
this.iframe.contentWindow.focus();
}

Expand Down Expand Up @@ -208,7 +205,6 @@ export class PausePlugin extends ButtonPlugin {
*/
onContainerFocus() {
this._containerBlurred = false;
this.focusApp();
this.manageFocus();
}

Expand Down Expand Up @@ -257,7 +253,7 @@ export class PausePlugin extends ButtonPlugin {
this.client.on('focus', this.onFocus);
this.client.on('keepFocus', this.onKeepFocus);

this.pause = this.pause;
this.pause = this._paused;

//ensure app has focus after setting up plugin
this.focusApp();
Expand Down
7,349 changes: 4,054 additions & 3,295 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 941c931

Please sign in to comment.