Changed functions to arrow functions for only-arrow-functions rule. (#13131)

This commit is contained in:
Patrick O'Carroll
2018-09-05 07:47:30 +02:00
committed by Torkel Ödegaard
parent 7c88436a9b
commit 72ab24f300
50 changed files with 367 additions and 367 deletions
+10 -10
View File
@@ -9,8 +9,8 @@ for (let i = 0; i < links.length; i++) {
}
const isWebkit = !!window.navigator.userAgent.match(/AppleWebKit\/([^ ;]*)/);
const webkitLoadCheck = function(link, callback) {
setTimeout(function() {
const webkitLoadCheck = (link, callback) => {
setTimeout(() => {
for (let i = 0; i < document.styleSheets.length; i++) {
const sheet = document.styleSheets[i];
if (sheet.href === link.href) {
@@ -21,19 +21,19 @@ const webkitLoadCheck = function(link, callback) {
}, 10);
};
const noop = function() {};
const noop = () => {};
const loadCSS = function(url) {
return new Promise(function(resolve, reject) {
const loadCSS = url => {
return new Promise((resolve, reject) => {
const link = document.createElement('link');
const timeout = setTimeout(function() {
const timeout = setTimeout(() => {
reject('Unable to load CSS');
}, waitSeconds * 1000);
const _callback = function(error) {
const _callback = error => {
clearTimeout(timeout);
link.onload = link.onerror = noop;
setTimeout(function() {
setTimeout(() => {
if (error) {
reject(error);
} else {
@@ -47,14 +47,14 @@ const loadCSS = function(url) {
link.href = url;
if (!isWebkit) {
link.onload = function() {
link.onload = () => {
_callback(undefined);
};
} else {
webkitLoadCheck(link, _callback);
}
link.onerror = function(evt: any) {
link.onerror = (evt: any) => {
_callback(evt.error || new Error('Error loading CSS file.'));
};