Skip to content

Commit

Permalink
resize memory leak fix thanks to @Omer
Browse files Browse the repository at this point in the history
  • Loading branch information
45kb committed May 18, 2016
1 parent 520c807 commit 0566cd3
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-tooltips",
"version": "1.1.0",
"version": "1.1.1",
"description": "Angular.js tooltips module.",
"authors": [
"Filippo Oretti <[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-tooltips.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions dist/angular-tooltips.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* angular-tooltips
* 1.1.0
* 1.1.1
*
* Angular.js tooltips module.
* http://720kb.github.io/angular-tooltips
*
* MIT license
* Wed May 11 2016
* Wed May 18 2016
*/
/*global angular,window*/
(function withAngular(angular, window) {
Expand All @@ -31,9 +31,12 @@
window.console.log('Skipped!');
}
}
, resizeTimeout
, resize = function resize() {

window.requestAnimationFrame(runCallbacks);
window.clearTimeout(resizeTimeout);
resizeTimeout = window.setTimeout(function onResizeTimeout() {
window.requestAnimationFrame(runCallbacks);
}, 500);
}
, addCallback = function addCallback(callback) {

Expand All @@ -51,6 +54,12 @@
window.addEventListener('resize', resize);
}
addCallback(callback);
},
'remove': function remove() {
if (!callbacks.length) {
window.clearTimeout(resizeTimeout);
window.removeEventListener('resize', resize);
}
}
};
}())
Expand Down Expand Up @@ -777,6 +786,7 @@
unregisterOnTooltipSizeChange();
unregisterOnTooltipSpeedChange();
unregisterTipContentChangeWatcher();
resizeObserver.remove();
element.off($attrs.tooltipShowTrigger + ' ' + $attrs.tooltipHideTrigger);
});
});
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-tooltips.js.min.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/angular-tooltips.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/angular-tooltips.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-tooltips",
"version": "1.1.0",
"version": "1.1.1",
"description": "Angular.js tooltips module.",
"homepage": "http://720kb.github.io/angular-tooltips",
"main": "index.js",
Expand Down

0 comments on commit 0566cd3

Please sign in to comment.