1.0.13 • Published 2 years ago

idle-preload v1.0.13

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

Idle Preload

Features

Preload something when the page is idle.

Idle detection algorithm:

  • After page loaded, use setTimeout and record the real callback time delay.
  • Compute the variance of multiple callback time delay.
  • The page is considered idle and stable when the variance is low.

Installation

yarn add idle-preload

or

npm i idle-preload --save

Usage

import { idlePreload } from 'idle-preload'

const preload = idlePreload({
  // options
  // debug: true
})
preload.push(() => {
  // use your code to preload something
  // 
})
preload.start()

Options

  • varianceLimit: Integer (default 5),
  • samplingCount: Integer (default 5),
  • afterWindowLoad: Boolean (default true),
  • checkTimeInterval: Integer (default 200) ms,
  • debug: Boolean (default false)

License

MIT

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago