How to use @ng-idle/core - 2 common examples

To help you get started, we’ve selected a few @ng-idle/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github moribvndvs / ng2-idle / projects / keepalive / src / lib / module.ts View on Github external
import { ModuleWithProviders, NgModule } from '@angular/core';
import { KeepaliveSvc, NgIdleModule } from '@ng-idle/core';

import { Keepalive } from './keepalive';

@NgModule({ imports: [NgIdleModule.forRoot()] })
export class NgIdleKeepaliveModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: NgIdleKeepaliveModule,
      providers: [Keepalive, { provide: KeepaliveSvc, useExisting: Keepalive }]
    };
  }
}
github NationalBankBelgium / stark / packages / stark-core / src / modules / session / session.module.ts View on Github external
import { UIRouterModule } from "@uirouter/angular";
import { NgIdleModule } from "@ng-idle/core";
import { NgIdleKeepaliveModule } from "@ng-idle/keepalive";
import { from } from "rxjs";
import { starkSessionReducers } from "./reducers";
import { STARK_SESSION_CONFIG, StarkSessionConfig } from "./entities";
import { STARK_SESSION_SERVICE, StarkSessionServiceImpl } from "./services";
import { STARK_ROUTING_SERVICE, StarkRoutingService } from "../routing/services";
import { SESSION_STATES } from "./routes";
import { starkLoginStateName, starkPreloadingStateName } from "./constants";
import { StarkAppContainerComponent } from "./components";

@NgModule({
	imports: [
		CommonModule,
		NgIdleModule.forRoot(),
		NgIdleKeepaliveModule.forRoot(),
		StoreModule.forFeature("StarkSession", starkSessionReducers),
		UIRouterModule.forChild({
			states: SESSION_STATES
		})
	],
	declarations: [StarkAppContainerComponent],
	exports: [StarkAppContainerComponent]
})
export class StarkSessionModule {
	/**
	 * Instantiates the services only once since they should be singletons
	 * so the forRoot() should be called only by the AppModule
	 * @link https://angular.io/guide/singleton-services#forroot
	 * @param sessionConfig - Object containing the configuration (if any) for the Session service
	 * @returns a module with providers

@ng-idle/core

A module for detecting and responding to the user becoming idle in Angular applications.

Apache-2.0
Latest version published 1 year ago

Package Health Score

68 / 100
Full package analysis

Popular @ng-idle/core functions