Skip to content

Commit 0566cd3

Browse files
committed
resize memory leak fix thanks to @Omer
1 parent 520c807 commit 0566cd3

File tree

7 files changed

+24
-14
lines changed

7 files changed

+24
-14
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-tooltips",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Angular.js tooltips module.",
55
"authors": [
66
"Filippo Oretti <[email protected]",

dist/angular-tooltips.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-tooltips.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* angular-tooltips
3-
* 1.1.0
3+
* 1.1.1
44
*
55
* Angular.js tooltips module.
66
* http://720kb.github.io/angular-tooltips
77
*
88
* MIT license
9-
* Wed May 11 2016
9+
* Wed May 18 2016
1010
*/
1111
/*global angular,window*/
1212
(function withAngular(angular, window) {
@@ -31,9 +31,12 @@
3131
window.console.log('Skipped!');
3232
}
3333
}
34+
, resizeTimeout
3435
, resize = function resize() {
35-
36-
window.requestAnimationFrame(runCallbacks);
36+
window.clearTimeout(resizeTimeout);
37+
resizeTimeout = window.setTimeout(function onResizeTimeout() {
38+
window.requestAnimationFrame(runCallbacks);
39+
}, 500);
3740
}
3841
, addCallback = function addCallback(callback) {
3942

@@ -51,6 +54,12 @@
5154
window.addEventListener('resize', resize);
5255
}
5356
addCallback(callback);
57+
},
58+
'remove': function remove() {
59+
if (!callbacks.length) {
60+
window.clearTimeout(resizeTimeout);
61+
window.removeEventListener('resize', resize);
62+
}
5463
}
5564
};
5665
}())
@@ -777,6 +786,7 @@
777786
unregisterOnTooltipSizeChange();
778787
unregisterOnTooltipSpeedChange();
779788
unregisterTipContentChangeWatcher();
789+
resizeObserver.remove();
780790
element.off($attrs.tooltipShowTrigger + ' ' + $attrs.tooltipHideTrigger);
781791
});
782792
});

dist/angular-tooltips.js.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-tooltips.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-tooltips.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-tooltips",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Angular.js tooltips module.",
55
"homepage": "http://720kb.github.io/angular-tooltips",
66
"main": "index.js",

0 commit comments

Comments
 (0)