# @angularclass/idle-preload

> Angular Idle Preload for preloading async routes via @TipeIO

Latest version **2.0.1** (published 2017-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @angularclass/idle-preload
pnpm add @angularclass/idle-preload
yarn add @angularclass/idle-preload
bun add @angularclass/idle-preload
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2017-11-17 |
| First published | 2016-11-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 99 |
| Author | PatrickJS |
| Maintainers | realmike33, hendrixer, andytjoslin, gdi2290, angularclass-npm |
| Keywords | angular idle, angular idle preload, angular2-idle-preload, @angularclass/idle-preload, angular preload routes, preload routes, preload, request idle callback, requestIdleCallback, Angular 2 requestIdleCallback, angular2, tipe, tipe.io, angular2modules, AngularClass, Angular Class, AngularClassModules, TipeModules |

## Links

- npm: https://www.npmjs.com/package/@angularclass/idle-preload
- Repository: https://github.com/gdi2290/angular-idle-preload
- Homepage: https://github.com/gdi2290/angular-idle-preload#readme
- Issues: https://github.com/gdi2290/angular-idle-preload/issues
- npm.io page: https://npm.io/package/@angularclass/idle-preload

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2017-11-17
- 1.0.4 — 2016-11-30
- 1.0.3 — 2016-11-29
- 1.0.2 — 2016-11-29
- 1.0.1 — 2016-11-29
- 1.0.0 — 2016-11-29

## README

<p align="center">
  <a href="https://tipe.io/" target="_blank">
    <img  alt="Tipe" src="https://user-images.githubusercontent.com/1016365/30999155-30430eb8-a488-11e7-850e-a7c38dad77c1.png" class="img-responsive">
  </a>
</p>

---

# Angular Idle Preload
> Angular Idle Preload for preloading async/lazy routes using `requestIdleCallback` (or fallback to setTimeout which is run outside of `zone.js` [Angular 5+)

### Why should I use angular-idle-preload?
Scheduling non-essential work yourself is very difficult to do. It’s impossible to figure out exactly how much frame time remains because after `requestAnimationFrame` callbacks execute there are style calculations, layout, paint, and other browser internals that need to run. A home-rolled solution can’t account for any of those. In order to be sure that a user isn’t interacting in some way you would also need to attach listeners to every kind of interaction event `(scroll, touch, click)`, even if you don’t need them for functionality, just so that you can be absolutely sure that the user isn’t interacting. The browser, on the other hand, knows exactly how much time is available at the end of the frame, and if the user is interacting, and so through `requestIdleCallback` we gain an API that allows us to make use of any spare time in the most efficient way possible.

![](https://developers.google.com/web/updates/images/2015-08-27-using-requestidlecallback/frame.jpg)

## links
* [Using requestIdleCallback](https://developers.google.com/web/updates/2015/08/using-requestidlecallback)
* [Cooperative Scheduling of Background Tasks](https://www.w3.org/TR/requestidlecallback/)

### Install
> `npm install angular-idle-preload --save`


```typescript
import { IdlePreload, IdlePreloadModule } from 'angular-idle-preload';

@NgModule({
  bootstrap: [ App ],
  imports: [
    IdlePreloadModule.forRoot(), // forRoot ensures the providers are only created once
    RouterModule.forRoot([], { useHash: false, preloadingStrategy: IdlePreload }),
  ]
})
export class Main {}
```


enjoy — **PatrtickJS**

---
_Source: https://npm.io/package/@angularclass/idle-preload · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
