fix: modernify code (#2068)

* fix: modernify code

* standard fix

* fixes
This commit is contained in:
Diego Rodríguez Baquero
2021-10-11 18:23:09 -05:00
committed by GitHub
parent c36e43eaa3
commit e42a515199
24 changed files with 134 additions and 161 deletions

View File

@@ -104,9 +104,7 @@ function onState (err, _state) {
const TorrentController = require('./controllers/torrent-controller')
return new TorrentController(state)
}),
torrentList: createGetter(() => {
return new TorrentListController(state)
}),
torrentList: createGetter(() => new TorrentListController(state)),
update: createGetter(() => {
const UpdateController = require('./controllers/update-controller')
return new UpdateController(state)
@@ -155,11 +153,11 @@ function onState (err, _state) {
// Add YouTube style hotkey shortcuts
window.addEventListener('keydown', onKeydown)
const debouncedFullscreenToggle = debounce(function () {
const debouncedFullscreenToggle = debounce(() => {
dispatch('toggleFullScreen')
}, 1000, true)
document.addEventListener('wheel', function (event) {
document.addEventListener('wheel', event => {
// ctrlKey detects pinch to zoom, http://crbug.com/289887
if (event.ctrlKey) {
event.preventDefault()
@@ -400,7 +398,7 @@ function setupIpc () {
function backToList () {
// Exit any modals and screens with a back button
state.modal = null
state.location.backToFirst(function () {
state.location.backToFirst(() => {
// If we were already on the torrent list, scroll to the top
const contentTag = document.querySelector('.content')
if (contentTag) contentTag.scrollTop = 0
@@ -590,7 +588,7 @@ function onWindowBoundsChanged (e, newBounds) {
}
function checkDownloadPath () {
fs.stat(state.saved.prefs.downloadPath, function (err, stat) {
fs.stat(state.saved.prefs.downloadPath, (err, stat) => {
if (err) {
state.downloadPathStatus = 'missing'
return console.error(err)