forked from turuslan/HackTimer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deprecated
- Loading branch information
Showing
1 changed file
with
10 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,11 @@ | ||
# HackTimer | ||
Avoid timers throttling by browser when tab is inactive | ||
|
||
# Usage: | ||
Place script reference to **HackTimer.js** (or HackTimer.min.js) before any other JavaScript. | ||
This includes library's such as jQuery as otherwise timed events such as fadeOut and fadeIn will break. | ||
|
||
# NPM | ||
Command: `npm install hacktimer --reg https://www.myget.org/F/hack-timer/npm` | ||
|
||
Latest version is 1.1.0 | ||
|
||
Registry URL: https://www.myget.org/F/hack-timer/npm | ||
|
||
# Bower | ||
Command: `bower install hacktimer` | ||
|
||
Latest version is 1.1.0 | ||
|
||
Registry: https://www.myget.org/F/hack-timer/bower/ | ||
|
||
You can specify bower registry in file `.bowerrc` in your working directory | ||
```json | ||
{ | ||
"registry": { | ||
"search": [ | ||
"https://www.myget.org/F/hack-timer/bower/", | ||
"https://bower.herokuapp.com" | ||
] | ||
} | ||
} | ||
# Deprecated | ||
## Use [chrisguttandin/worker-timers](https://github.com/chrisguttandin/worker-timers) instead | ||
Use monkey-patching to replace default `window.setInterval`, `window.clearInterval`, `window.setTimeout`, `window.clearTimeout`. | ||
|
||
```js | ||
import * as workerTimers from 'worker-timers'; | ||
window.setInterval = workerTimers.setInterval; | ||
window.clearInterval = workerTimers.clearInterval; | ||
window.setTimeout = workerTimers.setTimeout; | ||
window.clearTimeout = workerTimers.clearTimeout; | ||
``` | ||
|
||
# Notes | ||
Loader code **HackTimer.js** (or HackTimer.min.js) may be placed in separate file or in script tag. | ||
|
||
Worker code **HackTimerWorker.js** (or HackTimerWorker.min.js) must be placed in separate file. It is used to fallback if Blob is not supported | ||
|
||
To **change** worker code **script name** or path go to the end of **HackTimer.js** (or HackTimer.min.js) file and replace script name. | ||
|
||
**HackTimer.silent.min.js** writes to log only if initialisation failed. Use it with **HackTimerWorker.min.js** . | ||
|
||
# Warning | ||
Full code (HackTimer.js and HackTimerWorker.js) must not be used with minified (HackTimer.min.js and HackTimerWorker.min.js), i.e. **HackTimer.js** must use **only HackTimerWorker.js** and **HackTimer.min.js** must use **only HackTimerWorker.min.js** . |