From: Alexander Ebert Date: Sat, 2 Jan 2021 11:14:15 +0000 (+0100) Subject: Convert `Acp/Bootstrap` to TypeScript X-Git-Tag: 5.4.0_Alpha_1~484^2~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9668c97a8c40489a93ad6983d29d218d6029ab8e;p=GitHub%2FWoltLab%2FWCF.git Convert `Acp/Bootstrap` to TypeScript --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Bootstrap.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Bootstrap.js index 660e99e328..bb2e5b427c 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Bootstrap.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Bootstrap.js @@ -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 - * @module WoltLabSuite/Core/Acp/Bootstrap + * @author Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @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 index 882863fbd5..0000000000 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.js +++ /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 - * @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 index 0000000000..f6b594f737 --- /dev/null +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Acp/Bootstrap.ts @@ -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 + * @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(); +} diff --git a/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts b/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts index 9e3a44be55..68d4aa86d3 100644 --- a/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts +++ b/wcfsetup/install/files/ts/WoltLabSuite/Core/Bootstrap.ts @@ -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; }