forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[renderCounter] unify render counting login into directive
- Loading branch information
spalger
committed
Nov 23, 2016
1 parent
641f9af
commit 0c084ac
Showing
7 changed files
with
43 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import uiModules from 'ui/modules'; | ||
|
||
uiModules | ||
.get('kibana') | ||
.directive('renderCounter', () => ({ | ||
controller($scope, $element) { | ||
let counter = 0; | ||
|
||
const increment = () => { | ||
counter += 1; | ||
$element.attr('render-counter', counter); | ||
}; | ||
|
||
const teardown = () => { | ||
$element.off('renderComplete', increment); | ||
}; | ||
|
||
const setup = () => { | ||
$element.attr('render-counter', counter); | ||
$element.on('renderComplete', increment); | ||
$scope.$on('$destroy', teardown); | ||
}; | ||
|
||
this.disable = () => { | ||
$element.attr('render-counter', 'disabled'); | ||
teardown(); | ||
}; | ||
|
||
setup(); | ||
} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters