Skip to content

Commit

Permalink
[TASK] Use proper TypeScript functions instead of arrow functions
Browse files Browse the repository at this point in the history
Resolves: #91229
Releases: master, 9.5
Change-Id: Ieb6211252a74983a89b7a1057574a1ebe29ae390
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64341
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
  • Loading branch information
ohader committed Apr 29, 2020
1 parent 66d95e9 commit 07280a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BackendLogin {
/**
* Hide all form fields and show a progress message and icon
*/
public showLoginProcess = (): void => {
private showLoginProcess(): void {
this.showLoadingIndicator();
$(this.options.error).addClass('hidden');
$(this.options.errorNoCookies).addClass('hidden');
Expand All @@ -59,7 +59,7 @@ class BackendLogin {
/**
* Show the loading spinner in the submit button
*/
public showLoadingIndicator = (): void => {
private showLoadingIndicator(): void {
$(this.options.submitButton).button('loading');
}

Expand All @@ -68,7 +68,7 @@ class BackendLogin {
*
* @param {Event} event
*/
public handleSubmit = (event: Event): void => {
private handleSubmit(event: Event): void {
this.showLoginProcess();

if (typeof this.options.submitHandler === 'function') {
Expand All @@ -79,7 +79,7 @@ class BackendLogin {
/**
* Store the new selected Interface in a cookie to save it for future visits
*/
public interfaceSelectorChanged = (): void => {
private interfaceSelectorChanged(): void {
const now = new Date();
// cookie expires in one year
const expires = new Date(now.getTime() + 1000 * 60 * 60 * 24 * 365);
Expand All @@ -91,7 +91,7 @@ class BackendLogin {
/**
* Check if an interface was stored in a cookie and preselect it in the select box
*/
public checkForInterfaceCookie = (): void => {
private checkForInterfaceCookie(): void {
if ($(this.options.interfaceField).length) {
const posStart = document.cookie.indexOf('typo3-login-interface=');
if (posStart !== -1) {
Expand All @@ -105,15 +105,15 @@ class BackendLogin {
/**
* Hides input fields and shows cookie warning
*/
public showCookieWarning = (): void => {
private showCookieWarning(): void {
$(this.options.formFields).addClass('hidden');
$(this.options.errorNoCookies).removeClass('hidden');
}

/**
* Hides cookie warning and shows input fields
*/
public hideCookieWarning = (): void => {
private hideCookieWarning(): void {
$(this.options.formFields).removeClass('hidden');
$(this.options.errorNoCookies).addClass('hidden');
}
Expand All @@ -122,7 +122,7 @@ class BackendLogin {
* Checks browser's cookie support
* see http://stackoverflow.com/questions/8112634/jquery-detecting-cookies-enabled
*/
public checkCookieSupport = (): void => {
private checkCookieSupport(): void {
const cookieEnabled = navigator.cookieEnabled;

// when cookieEnabled flag is present and false then cookies are disabled.
Expand All @@ -148,13 +148,13 @@ class BackendLogin {
/**
* Registers listeners for the Login Interface
*/
public initializeEvents = (): void => {
$(document).ajaxStart(this.showLoadingIndicator);
$(this.options.loginForm).on('submit', this.handleSubmit);
private initializeEvents(): void {
$(document).ajaxStart(this.showLoadingIndicator.bind(this));
$(this.options.loginForm).on('submit', this.handleSubmit.bind(this));

// the Interface selector is not always present, so this check is needed
if ($(this.options.interfaceField).length > 0) {
$(document).on('change blur', this.options.interfaceField, this.interfaceSelectorChanged);
$(document).on('change blur', this.options.interfaceField, this.interfaceSelectorChanged.bind(this));
}

(<NodeListOf<HTMLInputElement>>document.querySelectorAll('.t3js-clearable')).forEach(
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Resources/Public/JavaScript/Login.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 07280a4

Please sign in to comment.