-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(#379): confirm exit from playground #515
base: master
Are you sure you want to change the base?
Conversation
@czerwinskilukasz1 looks like @km4 is taking care of #379 that you have raised :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @km4! Please apply Yonatan's suggestion and we can go with this 👍
@mhagmajer I see the light in the tunnel :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this @km4 ! Just a few nits below
@mhagmajer some update, check now and add feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting some finishing touches :)
if (dirty) return; | ||
playgroundIsDirty(!dirty); | ||
dirty = true; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that now when we have isDirty
check, we can just attach onbeforeunload
once for all without the need for the extra playgroundIsDirty
function.
}); | |
}); | |
window.onbeforeunload = function (e: any) { | |
if (isDirty) { | |
e.preventDefault(); | |
e.returnValue = ''; | |
} | |
}; |
@@ -81,6 +87,7 @@ async function executeAskScript( | |||
const json = await response.json(); | |||
if (response.status == 200) { | |||
showSuccessfulResponse(json.result); | |||
playgroundIsDirty(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
playgroundIsDirty(false); | |
isDirty = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mhagmajer
what about this isDirty flag? Now is undefined variable for this scope. If I push dirty params to all functions eg.
async function executeAskScript(
askScriptCode: string,
askScriptServerUrl: string,
isDirty: boolean
) {
executeAskScriptFromEditor(editor, askScriptServerUrl, isDirty);
the flag dosnt update in the top.
Closes #379