Browse Source

Don't load `lodash.fp` in converse-core. It's not being used there.

JC Brand 8 năm trước cách đây
mục cha
commit
e4d95eb794
4 tập tin đã thay đổi với 15 bổ sung11 xóa
  1. 4 1
      src/converse-controlbox.js
  2. 1 6
      src/converse-core.js
  3. 4 1
      src/converse-muc.js
  4. 6 3
      src/utils.js

+ 4 - 1
src/converse-controlbox.js

@@ -9,6 +9,7 @@
 (function (root, factory) {
     define(["jquery.noconflict",
             "converse-core",
+            "lodash.converter",
             "tpl!add_contact_dropdown",
             "tpl!add_contact_form",
             "tpl!change_status_message",
@@ -28,6 +29,7 @@
 }(this, function (
             $,
             converse,
+            lodashConverter,
             tpl_add_contact_dropdown,
             tpl_add_contact_form,
             tpl_change_status_message,
@@ -46,7 +48,8 @@
 
     const USERS_PANEL_ID = 'users';
     const CHATBOX_TYPE = 'chatbox';
-    const { Strophe, Backbone, utils, _, fp, moment } = converse.env;
+    const { Strophe, Backbone, utils, _, moment } = converse.env;
+    const fp = lodashConverter(_.runInContext());
 
 
     converse.plugins.add('converse-controlbox', {

+ 1 - 6
src/converse-core.js

@@ -9,7 +9,6 @@
     define(["sizzle",
             "es6-promise",
             "lodash.noconflict",
-            "lodash.converter",
             "polyfill",
             "utils",
             "moment_with_locales",
@@ -20,7 +19,7 @@
             "backbone.overview",
     ], factory);
 }(this, function (
-        sizzle, Promise, _, lodashConverter, polyfill,
+        sizzle, Promise, _, polyfill,
         utils, moment, Strophe, pluggable, Backbone) {
 
     /* Cannot use this due to Safari bug.
@@ -28,9 +27,6 @@
      */
     // "use strict";
 
-    // Create the FP (functional programming) version of lodash
-    const fp = lodashConverter(_.runInContext());
-
     // Strophe globals
     const { $build, $iq, $msg, $pres } = Strophe;
     const b64_sha1 = Strophe.SHA1.b64_sha1;
@@ -2357,7 +2353,6 @@
             'Strophe': Strophe,
             '_': _,
             'b64_sha1':  b64_sha1,
-            'fp': fp,
             'moment': moment,
             'sizzle': sizzle,
             'utils': utils

+ 4 - 1
src/converse-muc.js

@@ -13,6 +13,7 @@
     define([
             "jquery.noconflict",
             "converse-core",
+            "lodash.converter",
             "tpl!chatarea",
             "tpl!chatroom",
             "tpl!chatroom_disconnect",
@@ -38,6 +39,7 @@
 }(this, function (
             $,
             converse,
+            lodashConverter,
             tpl_chatarea,
             tpl_chatroom,
             tpl_chatroom_disconnect,
@@ -63,7 +65,8 @@
     const ROOMS_PANEL_ID = 'chatrooms';
     const CHATROOMS_TYPE = 'chatroom';
 
-    const { Strophe, Backbone, Promise, $iq, $build, $msg, $pres, b64_sha1, sizzle, utils, _, fp, moment } = converse.env;
+    const { Strophe, Backbone, Promise, $iq, $build, $msg, $pres, b64_sha1, sizzle, utils, _, moment } = converse.env;
+    const fp = lodashConverter(_.runInContext());
 
     // Add Strophe Namespaces
     Strophe.addNamespace('MUC_ADMIN', Strophe.NS.MUC + "#admin");

+ 6 - 3
src/utils.js

@@ -19,9 +19,11 @@
         "tpl!form_captcha"
     ], factory);
 }(this, function (
-        $, sizzle,
+        $,
+        sizzle,
         Promise,
-        dummy, _,
+        jQBrowser,
+        _,
         locales,
         moment,
         Strophe,
@@ -34,6 +36,7 @@
         tpl_form_input,
         tpl_form_captcha
     ) {
+
     "use strict";
     locales = locales || {};
     const b64_sha1 = Strophe.SHA1.b64_sha1;
@@ -399,7 +402,7 @@
         /* This works around a webkit bug. Refreshes the browser's viewport,
          * otherwise chatboxes are not moved along when one is closed.
          */
-        if ($.browser.webkit && window.requestAnimationFrame) {
+        if (jQBrowser.webkit && window.requestAnimationFrame) {
             window.requestAnimationFrame(function () {
                 var conversejs = document.getElementById('conversejs');
                 conversejs.style.display = 'none';