mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-01 10:14:28 +02:00
a little bit of dead code
This commit is contained in:
parent
d17ec768af
commit
e268b117bc
1 changed files with 3 additions and 28 deletions
|
@ -1,7 +1,6 @@
|
||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
|
|
||||||
var warnOnce = true;
|
var _warnOnce = true;
|
||||||
|
|
||||||
function detectZoom() {
|
function detectZoom() {
|
||||||
/**
|
/**
|
||||||
* Note: this method has only been tested on Chrome
|
* Note: this method has only been tested on Chrome
|
||||||
|
@ -11,9 +10,9 @@ function detectZoom() {
|
||||||
* so I can't use it. The ecosystem for zoom level detection is a mess
|
* so I can't use it. The ecosystem for zoom level detection is a mess
|
||||||
*/
|
*/
|
||||||
if (!window.outerWidth || !window.innerWidth) {
|
if (!window.outerWidth || !window.innerWidth) {
|
||||||
if (warnOnce) {
|
if (_warnOnce) {
|
||||||
console.warn("Can't detect zoom level correctly :-/");
|
console.warn("Can't detect zoom level correctly :-/");
|
||||||
warnOnce = false;
|
_warnOnce = false;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -21,29 +20,5 @@ function detectZoom() {
|
||||||
return window.outerWidth / window.innerWidth;
|
return window.outerWidth / window.innerWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
var locked = true;
|
|
||||||
var setupZoomPoll = function(callback, context) {
|
|
||||||
var currentZoom = 0;
|
|
||||||
|
|
||||||
setInterval(function() {
|
|
||||||
var newZoom = detectZoom();
|
|
||||||
|
|
||||||
if (newZoom !== currentZoom) {
|
|
||||||
// we need to wait one more before issuing callback
|
|
||||||
// to avoid window resize issues
|
|
||||||
if (locked) {
|
|
||||||
locked = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentZoom = newZoom;
|
|
||||||
callback.apply(context, [newZoom]);
|
|
||||||
} else {
|
|
||||||
locked = true;
|
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.setupZoomPoll = setupZoomPoll;
|
|
||||||
exports.detectZoom = detectZoom;
|
exports.detectZoom = detectZoom;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue