Merge branch 'master' of https://github.com/ctubio/HackTimer_fork into ctubio-master

# Conflicts:
#	README.md
This commit is contained in:
turuslan 2018-10-12 07:02:44 +03:00
commit 7e7b1fe8e0
3 changed files with 35 additions and 18 deletions

View File

@ -137,7 +137,6 @@ onmessage = function (event) {\
worker.onerror = function (event) {
console.log (event);
};
console.log (logPrefix + 'Initialisation succeeded');
} catch (error) {
console.log (logPrefix + 'Initialisation failed');
console.error (error);
@ -145,4 +144,4 @@ onmessage = function (event) {\
} else {
console.log (logPrefix + 'Initialisation failed - HTML5 Web Worker is not supported');
}
}) ('HackTimerWorker.js');
}) ('HackTimerWorker.js');

View File

@ -1,11 +1,32 @@
# 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`.
# HackTimer
Avoid timers throttling by browser when tab is inactive
```js
import * as workerTimers from 'worker-timers';
window.setInterval = workerTimers.setInterval;
window.clearInterval = workerTimers.clearInterval;
window.setTimeout = workerTimers.setTimeout;
window.clearTimeout = workerTimers.clearTimeout;
# 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`
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"
]
}
}
```

View File

@ -1,14 +1,11 @@
{
"name": "hacktimer",
"version": "1.1.0",
"version": "1.1.3",
"description": "Avoid timers throttling by browser when tab is inactive",
"main": "HackTimer.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/turuslan/HackTimer.git"
"url": "git+https://github.com/ctubio/HackTimer.git"
},
"keywords": [
"suspend",
@ -25,7 +22,7 @@
"author": "turuslan <turuslan.devbox@gmail.com> (http://github.com/turuslan/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/turuslan/HackTimer/issues"
"url": "https://github.com/ctubio/HackTimer/issues"
},
"homepage": "https://github.com/turuslan/HackTimer"
"homepage": "https://github.com/ctubio/HackTimer"
}