Created
May 25, 2017 12:57
-
-
Save sis0k0/11ebb610301e305563cb3b805844d722 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { NgModule, APP_INITIALIZER } from "@angular/core"; | |
| import { NativeScriptModule } from "nativescript-angular/nativescript.module"; | |
| import { | |
| on as applicationOn, | |
| suspendEvent, | |
| ApplicationEventData, | |
| } from "application"; | |
| import { AppComponent } from "./app.component"; | |
| import { CountDownTimerService } from "./countdown-timer.service"; | |
| export const handleSuspend = (countDownTimerService: CountDownTimerService) => | |
| () => applicationOn(suspendEvent, (args: ApplicationEventData) => { | |
| if (args.android) { | |
| countDownTimerService.startCountDown(1); | |
| } else if (args.ios) { | |
| console.log("UIApplication: " + args.ios); | |
| } | |
| }); | |
| @NgModule({ | |
| bootstrap: [ AppComponent ], | |
| imports: [ NativeScriptModule, ], | |
| declarations: [ AppComponent, ], | |
| providers: [ | |
| CountDownTimerService, | |
| { | |
| provide: APP_INITIALIZER, | |
| useFactory: handleSuspend, | |
| deps: [CountDownTimerService], | |
| multi: true, | |
| }, | |
| ], | |
| }) | |
| export class AppModule { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment