Ver Fonte

Make strophe.roster.js an AMD module.

JC Brand há 10 anos atrás
pai
commit
0121914cda
1 ficheiros alterados com 28 adições e 2 exclusões
  1. 28 2
      src/strophe.roster.js

+ 28 - 2
src/strophe.roster.js

@@ -13,8 +13,33 @@
  *  * authorize/unauthorize
  *  * roster versioning (xep 237)
  */
-Strophe.addConnectionPlugin('roster',
-{
+(function (root, factory) {
+    if (typeof define === 'function' && define.amd) {
+        // AMD. Register as an anonymous module.
+        define([
+            "strophe-full"
+        ], function (Strophe) {
+            factory(
+                Strophe.Strophe,
+                Strophe.$build,
+                Strophe.$iq ,
+                Strophe.$msg,
+                Strophe.$pres
+            );
+        });
+    } else {
+        // Browser globals
+        factory(
+            root.Strophe,
+            root.$build,
+            root.$iq ,
+            root.$msg,
+            root.$pres
+        );
+    }
+}(this, function (Strophe, $build, $iq, $msg, $pres) {
+
+Strophe.addConnectionPlugin('roster', {
     /** Function: init
      * Plugin init
      *
@@ -445,3 +470,4 @@ Strophe.addConnectionPlugin('roster',
         }
     }
 });
+}));