mirror of
https://github.com/generativefm/generative.fm.git
synced 2026-04-26 03:00:08 -04:00
Confirm beforeunload when a recording is in progress
This commit is contained in:
@@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Shuffle removed from mobile devices to make room for timer button
|
||||
|
||||
### Fixed
|
||||
|
||||
- Desktop users will be asked to confirm when navigating away from the site while a recording is in progress
|
||||
|
||||
## [0.14.0] - 2019-04-21
|
||||
|
||||
### Added
|
||||
|
||||
@@ -11,8 +11,11 @@ const beforeUnloadMiddleware = store => next => {
|
||||
if (isProduction) {
|
||||
return action => {
|
||||
const result = next(action);
|
||||
const { isPlaying } = store.getState();
|
||||
if (isPlaying) {
|
||||
const { isPlaying, generatedRecordings } = store.getState();
|
||||
const isRecordingInProgress = Reflect.ownKeys(generatedRecordings).some(
|
||||
recordingId => generatedRecordings[recordingId].isInProgress
|
||||
);
|
||||
if (isPlaying || isRecordingInProgress) {
|
||||
if (!isListening) {
|
||||
isListening = true;
|
||||
window.addEventListener('beforeunload', handleBeforeUnload);
|
||||
|
||||
Reference in New Issue
Block a user