Permalink
Browse files

Merge pull request #7318 from vingtetun/827137

Bug 827137 - Cost control running with foreground priority when not visi...
  • Loading branch information...
2 parents cba0de2 + d599a51 commit 194062b4e8b17a38247d5417094ab9743bd862b2 @vingtetun vingtetun committed Jan 7, 2013
Showing with 15 additions and 7 deletions.
  1. +15 −7 apps/system/js/cost_control.js
@@ -52,26 +52,34 @@
}
function _showWidget() {
- if (widgetFrame)
- widgetFrame.setVisible(true);
+ if (!widgetFrame) {
+ _ensureWidget();
+ }
+ widgetFrame.setVisible(true);
}
function _hideWidget() {
- if (widgetFrame)
+ if (widgetFrame) {
widgetFrame.setVisible(false);
+ }
}
// Listen to utilitytray show
- window.addEventListener('utilitytrayshow', _ensureWidget);
window.addEventListener('utilitytrayshow', _showWidget);
window.addEventListener('utilitytrayhide', _hideWidget);
window.addEventListener('applicationready', function _onReady() {
asyncStorage.getItem('ftu.enabled', function _onValue(enabled) {
- if (enabled !== false)
- window.addEventListener('ftudone', _ensureWidget);
- else
+ if (enabled !== false) {
+ window.addEventListener('ftudone', function ftudone(e) {
+ window.removeEventListener('ftudone', ftudone);
+ _ensureWidget();
+ widgetFrame.setVisible(false);
+ });
+ } else {
_ensureWidget();
+ widgetFrame.setVisible(false);
+ }
});
});
}());

0 comments on commit 194062b

Please sign in to comment.