diff --git a/src/app/classes/interceptor.ts b/src/app/classes/interceptor.ts index 9877231c1..587c9ca9d 100644 --- a/src/app/classes/interceptor.ts +++ b/src/app/classes/interceptor.ts @@ -32,7 +32,7 @@ export class CoreInterceptor implements HttpInterceptor { */ static serialize(obj: any, addNull?: boolean): string { let query = ''; - let fullSubName; + let fullSubName: string; let subValue; let innerObj; @@ -68,10 +68,11 @@ export class CoreInterceptor implements HttpInterceptor { const newReq = req.clone({ headers: req.headers.set('Content-Type', 'application/x-www-form-urlencoded'), body: typeof req.body == 'object' && String(req.body) != '[object File]' ? - CoreInterceptor.serialize(req.body) : req.body + CoreInterceptor.serialize(req.body) : req.body, }); // Pass on the cloned request instead of the original request. return next.handle(newReq); } + } diff --git a/src/app/classes/native-to-angular-http.ts b/src/app/classes/native-to-angular-http.ts index e21e7eb7e..08349dd30 100644 --- a/src/app/classes/native-to-angular-http.ts +++ b/src/app/classes/native-to-angular-http.ts @@ -92,7 +92,8 @@ export class CoreNativeToAngularHttpResponse extends AngularHttpResponse { headers: new HttpHeaders(nativeResponse.headers), status: nativeResponse.status, statusText: HTTP_STATUS_MESSAGES[nativeResponse.status] || '', - url: nativeResponse.url || '' + url: nativeResponse.url || '', }); } + } diff --git a/src/app/classes/queue-runner.ts b/src/app/classes/queue-runner.ts index fbc5d1d22..aa9868ccd 100644 --- a/src/app/classes/queue-runner.ts +++ b/src/app/classes/queue-runner.ts @@ -53,6 +53,7 @@ export type CoreQueueRunnerAddOptions = { * A queue to prevent having too many concurrent executions. */ export class CoreQueueRunner { + protected queue: {[id: string]: CoreQueueRunnerItem} = {}; protected orderedQueue: CoreQueueRunnerItem[] = []; protected numberRunning = 0; @@ -140,4 +141,5 @@ export class CoreQueueRunner { return item.deferred.promise; } + } diff --git a/src/app/classes/singletons-factory.ts b/src/app/classes/singletons-factory.ts index 3415762a2..562b9a3a4 100644 --- a/src/app/classes/singletons-factory.ts +++ b/src/app/classes/singletons-factory.ts @@ -80,4 +80,5 @@ export class CoreSingletonsFactory { }; } + } diff --git a/src/app/singletons/logger.ts b/src/app/singletons/logger.ts index c189192da..ee8f9fc4e 100644 --- a/src/app/singletons/logger.ts +++ b/src/app/singletons/logger.ts @@ -27,12 +27,18 @@ import { environment } from '@/environments/environment'; * Then you can call the log function you want to use in this logger instance. */ export class CoreLogger { + log: LogFunction; info: LogFunction; warn: LogFunction; debug: LogFunction; error: LogFunction; + // Avoid creating singleton instances. + private constructor() { + // Nothing to do. + } + /** * Get a logger instance for a certain class, service or component. * @@ -88,6 +94,7 @@ export class CoreLogger { logFn.apply(null, args); }; } + } /** diff --git a/src/app/singletons/url.ts b/src/app/singletons/url.ts index 36a2d9acb..d17af5bc6 100644 --- a/src/app/singletons/url.ts +++ b/src/app/singletons/url.ts @@ -72,7 +72,9 @@ interface UrlParts { export class CoreUrl { // Avoid creating singleton instances. - private constructor() {} + private constructor() { + // Nothing to do. + } /** * Parse parts of a url, using an implicit protocol if it is missing from the url. @@ -123,14 +125,14 @@ export class CoreUrl { // Match using common suffixes. const knownSuffixes = [ - '\/my\/?', - '\/\\\?redirect=0', - '\/index\\\.php', - '\/course\/view\\\.php', - '\/login\/index\\\.php', - '\/mod\/page\/view\\\.php', + '/my/?', + '/\\?redirect=0', + '/index\\.php', + '/course/view\\.php', + '\\/login/index\\.php', + '/mod/page/view\\.php', ]; - const match = url.match(new RegExp(`^https?:\/\/(.*?)(${knownSuffixes.join('|')})`)); + const match = url.match(new RegExp(`^https?://(.*?)(${knownSuffixes.join('|')})`)); if (match) { return match[1]; @@ -184,10 +186,10 @@ export class CoreUrl { */ static sameDomainAndPath(urlA: string, urlB: string): boolean { // Add protocol if missing, the parse function requires it. - if (!urlA.match(/^[^\/:\.\?]*:\/\//)) { + if (!urlA.match(/^[^/:.?]*:\/\//)) { urlA = `https://${urlA}`; } - if (!urlB.match(/^[^\/:\.\?]*:\/\//)) { + if (!urlB.match(/^[^/:.?]*:\/\//)) { urlB = `https://${urlB}`; } @@ -197,4 +199,5 @@ export class CoreUrl { return partsA.domain == partsB.domain && CoreTextUtils.instance.removeEndingSlash(partsA.path) == CoreTextUtils.instance.removeEndingSlash(partsB.path); } + } diff --git a/src/app/singletons/window.ts b/src/app/singletons/window.ts index 4ea9f6d46..2fe01da42 100644 --- a/src/app/singletons/window.ts +++ b/src/app/singletons/window.ts @@ -32,6 +32,11 @@ export type CoreWindowOpenOptions = { */ export class CoreWindow { + // Avoid creating singleton instances. + private constructor() { + // Nothing to do. + } + /** * "Safe" implementation of window.open. It will open the URL without overriding the app. * @@ -73,4 +78,5 @@ export class CoreWindow { } } } + }