浏览代码

use a robust way to find whether running in electron

codepiano 10 年之前
父节点
当前提交
d9100b2254
共有 3 个文件被更改,包括 5 次插入5 次删除
  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 {

文件差异内容过多而无法显示
+ 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 {