Fix unnecessary closure capture

This commit is contained in:
Haocen Xu 2019-11-21 12:25:32 -05:00
parent af8d963fd2
commit 853fd906cb
No known key found for this signature in database
GPG Key ID: 3F0D955A0F6AD729
1 changed files with 17 additions and 23 deletions

View File

@ -3669,25 +3669,21 @@ jQuery.PrivateBin = (function($, RawDeflate) {
const $emailconfirmTimezoneCurrent = $emailconfirmmodal.find('#emailconfirm-timezone-current'); const $emailconfirmTimezoneCurrent = $emailconfirmmodal.find('#emailconfirm-timezone-current');
const $emailconfirmTimezoneUtc = $emailconfirmmodal.find('#emailconfirm-timezone-utc'); const $emailconfirmTimezoneUtc = $emailconfirmmodal.find('#emailconfirm-timezone-utc');
$emailconfirmTimezoneCurrent.off('click.sendEmailCurrentTimezone'); $emailconfirmTimezoneCurrent.off('click.sendEmailCurrentTimezone');
$emailconfirmTimezoneCurrent.on('click.sendEmailCurrentTimezone', function(expirationDateRoundedToSecond, isBurnafterreading) { $emailconfirmTimezoneCurrent.on('click.sendEmailCurrentTimezone', () => {
return function() { const emailBody = templateEmailBody(expirationDateRoundedToSecond.toLocaleString(), isBurnafterreading);
const emailBody = templateEmailBody(expirationDateRoundedToSecond.toLocaleString(), isBurnafterreading); $emailconfirmmodal.modal('hide');
$emailconfirmmodal.modal('hide'); triggerEmailSend(emailBody);
triggerEmailSend(emailBody); });
};
} (expirationDateRoundedToSecond, isBurnafterreading));
$emailconfirmTimezoneUtc.off('click.sendEmailUtcTimezone'); $emailconfirmTimezoneUtc.off('click.sendEmailUtcTimezone');
$emailconfirmTimezoneUtc.on('click.sendEmailUtcTimezone', function(expirationDateRoundedToSecond, isBurnafterreading) { $emailconfirmTimezoneUtc.on('click.sendEmailUtcTimezone', () => {
return function() { const emailBody = templateEmailBody(expirationDateRoundedToSecond.toLocaleString(
const emailBody = templateEmailBody(expirationDateRoundedToSecond.toLocaleString( undefined,
undefined, // we don't use Date.prototype.toUTCString() because we would like to avoid GMT
// we don't use Date.prototype.toUTCString() because we would like to avoid GMT { timeZone: 'UTC', dateStyle: 'long', timeStyle: 'long' }
{ timeZone: 'UTC', dateStyle: 'long', timeStyle: 'long' } ), isBurnafterreading);
), isBurnafterreading); $emailconfirmmodal.modal('hide');
$emailconfirmmodal.modal('hide'); triggerEmailSend(emailBody);
triggerEmailSend(emailBody); });
};
} (expirationDateRoundedToSecond, isBurnafterreading));
$emailconfirmmodal.modal('show'); $emailconfirmmodal.modal('show');
} else { } else {
triggerEmailSend(templateEmailBody(null, isBurnafterreading)); triggerEmailSend(templateEmailBody(null, isBurnafterreading));
@ -3863,11 +3859,9 @@ jQuery.PrivateBin = (function($, RawDeflate) {
$emailLink.removeClass('hidden'); $emailLink.removeClass('hidden');
$emailLink.off('click.sendEmail'); $emailLink.off('click.sendEmail');
$emailLink.on('click.sendEmail', function(expirationDate, isBurnafterreading) { $emailLink.on('click.sendEmail', () => {
return function() { sendEmail(expirationDate, isBurnafterreading);
sendEmail(expirationDate, isBurnafterreading); });
};
} (expirationDate, isBurnafterreading));
} catch (error) { } catch (error) {
console.error(error); console.error(error);
Alert.showError( Alert.showError(