Convert `Acp/Bootstrap` to TypeScript
authorAlexander Ebert <ebert@woltlab.com>
Sat, 2 Jan 2021 11:14:15 +0000 (12:14 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 2 Jan 2021 11:14:15 +0000 (12:14 +0100)
wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Bootstrap.js
wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.js [deleted file]
wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.ts [new file with mode: 0644]
wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts

index 660e99e328088703efe371433885ca6cf0e4eb6d..bb2e5b427c51846060ed78cb7059c923bcdff3e0 100644 (file)
@@ -1,30 +1,30 @@
 /**
  * Bootstraps WCF's JavaScript with additions for the ACP usage.
  *
- * @author     Alexander Ebert
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module     WoltLabSuite/Core/Acp/Bootstrap
+ * @author  Alexander Ebert
+ * @copyright  2001-2019 WoltLab GmbH
+ * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Acp/Bootstrap
  */
-define(['Core', 'WoltLabSuite/Core/Bootstrap', './Ui/Page/Menu'], function (Core, Bootstrap, UiPageMenu) {
+define(["require", "exports", "tslib", "../Core", "../Bootstrap", "./Ui/Page/Menu"], function (require, exports, tslib_1, Core, Bootstrap_1, UiPageMenu) {
     "use strict";
+    Object.defineProperty(exports, "__esModule", { value: true });
+    exports.setup = void 0;
+    Core = tslib_1.__importStar(Core);
+    UiPageMenu = tslib_1.__importStar(UiPageMenu);
     /**
-     * @exports        WoltLabSuite/Core/Acp/Bootstrap
+     * Bootstraps general modules and frontend exclusive ones.
+     *
+     * @param  {Object=}  options    bootstrap options
      */
-    return {
-        /**
-         * Bootstraps general modules and frontend exclusive ones.
-         *
-         * @param      {Object=}       options         bootstrap options
-         */
-        setup: function (options) {
-            options = Core.extend({
-                bootstrap: {
-                    enableMobileMenu: true
-                }
-            }, options);
-            Bootstrap.setup(options.bootstrap);
-            UiPageMenu.init();
-        }
-    };
+    function setup(options) {
+        options = Core.extend({
+            bootstrap: {
+                enableMobileMenu: true,
+            },
+        }, options);
+        Bootstrap_1.setup(options.bootstrap);
+        UiPageMenu.init();
+    }
+    exports.setup = setup;
 });
diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.js b/wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.js
deleted file mode 100644 (file)
index 882863f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * Bootstraps WCF's JavaScript with additions for the ACP usage.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2019 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @module     WoltLabSuite/Core/Acp/Bootstrap
- */
-define(['Core', 'WoltLabSuite/Core/Bootstrap', './Ui/Page/Menu'], function(Core, Bootstrap, UiPageMenu) {
-       "use strict";
-       
-       /**
-        * @exports     WoltLabSuite/Core/Acp/Bootstrap
-        */
-       return {
-               /**
-                * Bootstraps general modules and frontend exclusive ones.
-                * 
-                * @param       {Object=}       options         bootstrap options
-                */
-               setup: function(options) {
-                       options = Core.extend({
-                               bootstrap: {
-                                       enableMobileMenu: true
-                               }
-                       }, options);
-                       
-                       Bootstrap.setup(options.bootstrap);
-                       UiPageMenu.init();
-               }
-       };
-});
diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.ts
new file mode 100644 (file)
index 0000000..f6b594f
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Bootstraps WCF's JavaScript with additions for the ACP usage.
+ *
+ * @author  Alexander Ebert
+ * @copyright  2001-2019 WoltLab GmbH
+ * @license  GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @module  WoltLabSuite/Core/Acp/Bootstrap
+ */
+
+import * as Core from "../Core";
+import { BoostrapOptions, setup as bootstrapSetup } from "../Bootstrap";
+import * as UiPageMenu from "./Ui/Page/Menu";
+
+interface AcpBootstrapOptions {
+  bootstrap: BoostrapOptions;
+}
+
+/**
+ * Bootstraps general modules and frontend exclusive ones.
+ *
+ * @param  {Object=}  options    bootstrap options
+ */
+export function setup(options: AcpBootstrapOptions): void {
+  options = Core.extend(
+    {
+      bootstrap: {
+        enableMobileMenu: true,
+      },
+    },
+    options,
+  ) as AcpBootstrapOptions;
+
+  bootstrapSetup(options.bootstrap);
+  UiPageMenu.init();
+}
index 9e3a44be55ebe7abee2015201fe3646a63e3521a..68d4aa86d35a57a1f5ae5761896ca6b9404d3f7e 100644 (file)
@@ -42,7 +42,7 @@ window.WCF.Language.addObject = Language.addObject;
 // WCF.System.Event compatibility
 window.__wcf_bc_eventHandler = EventHandler;
 
-interface BoostrapOptions {
+export interface BoostrapOptions {
   enableMobileMenu: boolean;
 }