Pārlūkot izejas kodu

Also handle case where AMD is not present

JC Brand 12 gadi atpakaļ
vecāks
revīzija
d38af7ed89
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      Libraries/strophe.muc.js

+ 5 - 0
Libraries/strophe.muc.js

@@ -12,6 +12,9 @@
 
 // AMD/global registrations
 (function (root, factory) {
+    if (console===undefined || console.log===undefined) {
+        console = { log: function () {}, error: function () {} };
+    }
     if (typeof define === 'function' && define.amd) { 
         define([
             "Libraries/strophe"
@@ -22,6 +25,8 @@
                 return factory(jQuery, console);
             }
         );
+    } else { 
+        return factory(jQuery, console);
     }
 }(this, function ($, console) {