Browse Source

use a robust way to find whether running in electron

codepiano 10 years ago
parent
commit
d9100b2254
3 changed files with 5 additions and 5 deletions
  1. 2 2
      dist/js/bootstrap-dialog.js
  2. 1 1
      dist/js/bootstrap-dialog.min.js
  3. 2 2
      src/js/bootstrap-dialog.js

+ 2 - 2
dist/js/bootstrap-dialog.js

@@ -17,8 +17,8 @@
 
     // CommonJS module is defined
     if (typeof module !== 'undefined' && module.exports) {
-        var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
-        var isElectron = isNode && (typeof require('ipc') !== "undefined");
+        var isNode = (typeof process !== "undefined");
+        var isElectron = isNode && ('electron' in process.versions);
         if(isElectron) {
             root.BootstrapDialog = factory(root.jQuery);
         } else {

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrap-dialog.min.js


+ 2 - 2
src/js/bootstrap-dialog.js

@@ -17,8 +17,8 @@
 
     // CommonJS module is defined
     if (typeof module !== 'undefined' && module.exports) {
-        var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
-        var isElectron = isNode && (typeof require('ipc') !== "undefined");
+        var isNode = (typeof process !== "undefined");
+        var isElectron = isNode && ('electron' in process.versions);
         if(isElectron) {
             root.BootstrapDialog = factory(root.jQuery);
         } else {