diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/customLoader/custom-loader.service.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/customLoader/custom-loader.service.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/components/customLoader/custom-loader.service.ts b/vid-webpack-master/src/app/shared/components/customLoader/custom-loader.service.ts new file mode 100644 index 000000000..398eac233 --- /dev/null +++ b/vid-webpack-master/src/app/shared/components/customLoader/custom-loader.service.ts @@ -0,0 +1,34 @@ +import {Injectable} from "@angular/core"; +import {LoaderComponent} from "./custom-loader.component"; + +@Injectable() +export class LoaderService { + + private mainLoaderName = 'general'; + public registeredLoaders = {}; + + register(name: string, loader: LoaderComponent) { + if (!this.registeredLoaders[name]) { + this.registeredLoaders[name] = loader; + } + } + + unregister(name: string) { + if (this.registeredLoaders[name]) { + delete this.registeredLoaders[name]; + } + } + + activate(name: string = this.mainLoaderName) { + if (this.registeredLoaders[name]) { + this.registeredLoaders[name].activate(); + } + } + + deactivate(name: string = this.mainLoaderName) { + if (this.registeredLoaders[name]) { + this.registeredLoaders[name].deactivate(); + } + } + +} |