From 9aae0faef710d58ec7e0a841b4fba39f3ed4c3fd Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 2 Jul 2019 12:37:51 +0200 Subject: [PATCH] don\'t stop closing if not electron --- package.json | 5 +++-- src/app.js | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a322596e75..f4d9db00f7 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "fast-async": "^7.0.6", "fast-levenshtein": "^2.0.6", "gists": "^1.0.1", + "is-electron": "^2.2.0", "javascript-serialize": "^1.6.1", "jquery": "^3.3.1", "js-base64": "^2.1.9", @@ -58,6 +59,7 @@ "request": "^2.83.0", "rimraf": "^2.6.1", "selenium-standalone": "^6.0.1", + "semver": "^6.1.2", "solc": "^0.5.0", "standard": "^8.5.0", "swarmgw": "^0.3.1", @@ -68,8 +70,7 @@ "web3": "1.0.0-beta.27", "webworkify": "^1.2.1", "yo-yo": "^1.2.2", - "yo-yoify": "^3.7.3", - "semver": "^6.1.2" + "yo-yoify": "^3.7.3" }, "dependencies": { "http-server": "^0.11.1", diff --git a/src/app.js b/src/app.js index 563d43e05f..2bfe1b04eb 100644 --- a/src/app.js +++ b/src/app.js @@ -1,6 +1,7 @@ /* global localStorage */ 'use strict' +var isElectron = require('is-electron') var $ = require('jquery') var csjs = require('csjs-inject') var yo = require('yo-yo') @@ -259,9 +260,11 @@ Please make a backup of your contracts and start using http://remix.ethereum.org if (window.location.protocol.indexOf('https') === 0) { toolTip('You are using an `https` connection. Please switch to `http` if you are using Remix against an `http Web3 provider` or allow Mixed Content in your browser.') } - // Oops! Accidentally trigger refresh or bookmark. - window.onbeforeunload = function () { - return 'Are you sure you want to leave?' + if (!isElectron()) { + // Oops! Accidentally trigger refresh or bookmark. + window.onbeforeunload = function () { + return 'Are you sure you want to leave?' + } } let appStore = new EntityStore('module', 'name')