浏览代码

console can be defined higher up

JC Brand 12 年之前
父节点
当前提交
dbf20052c3
共有 1 个文件被更改,包括 3 次插入8 次删除
  1. 3 8
      converse.js

+ 3 - 8
converse.js

@@ -11,8 +11,10 @@
 
 // AMD/global registrations
 (function (root, factory) {
+    if (console===undefined || console.log===undefined) {
+        console = { log: function () {}, error: function () {} };
+    }
     if (typeof define === 'function' && define.amd) { 
-
         require.config({
             // paths: {
             //     "patterns": "Libraries/Patterns"
@@ -58,10 +60,6 @@
                     evaluate : /\{\[([\s\S]+?)\]\}/g,
                     interpolate : /\{\{([\s\S]+?)\}\}/g
                 };
-
-                if (console===undefined || console.log===undefined) {
-                    console = { log: function () {}, error: function () {} };
-                }
                 return factory(jQuery, store, _, console);
             }
         );
@@ -72,9 +70,6 @@
             evaluate : /\{\[([\s\S]+?)\]\}/g,
             interpolate : /\{\{([\s\S]+?)\}\}/g
         };
-        if (console===undefined || console.log===undefined) {
-            console = { log: function () {}, error: function () {} };
-        }
         root.xmppchat = factory(jQuery, store, _, console || {log: function(){}});
     }
 }(this, function ($, store, _, console) {