Skip to content

Instantly share code, notes, and snippets.

@tomasstankovic
Created January 24, 2017 10:30
Show Gist options
  • Save tomasstankovic/e8f9b5b3e87784ae96e71c4338928bb2 to your computer and use it in GitHub Desktop.
Save tomasstankovic/e8f9b5b3e87784ae96e71c4338928bb2 to your computer and use it in GitHub Desktop.
import { Injectable } from '@angular/core';
@Injectable()
export class PreloaderService {
public static fullLoadingCount: number = 0;
public static smallLoadingCount: number = 0;
getPreloaderCount(preloaderType = 'full'): number {
if (preloaderType === 'full') {
return PreloaderService.fullLoadingCount;
} else if (preloaderType === 'small') {
return PreloaderService.smallLoadingCount;
}
}
showPreloader(preloaderType = 'full'): void {
if (preloaderType === 'full') {
PreloaderService.fullLoadingCount++;
} else if (preloaderType === 'small') {
PreloaderService.smallLoadingCount++;
}
}
hidePreloader(preloaderType = 'full'): void {
if (preloaderType === 'full') {
PreloaderService.fullLoadingCount--;
} else if (preloaderType === 'small') {
PreloaderService.smallLoadingCount--;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment