Encapsulate directive functions in anonymous functions - avoid the global namespace

This commit is contained in:
Kevin Gisi
2015-06-21 23:52:08 -04:00
parent b4c4b891a1
commit 78b424e247
10 changed files with 278 additions and 258 deletions

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('focusMe', focusMe);
@@ -21,3 +22,4 @@ function focusMe($timeout, $parse) {
}
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('fromNow', fromNow);
@@ -42,3 +43,4 @@ function fromNow($interval, $timeout) {
});
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('habitrpgTasks', habitrpgTasks);
@@ -59,3 +60,4 @@ function habitrpgTasks($rootScope, User) {
}
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('hrpgSortChecklist', hrpgSortChecklist);
@@ -28,3 +29,4 @@ function hrpgSortChecklist(User) {
});
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('hrpgSortTags', hrpgSortTags);
@@ -25,3 +26,4 @@ function hrpgSortTags(User) {
});
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('hrpgSortTasks', hrpgSortTasks);
@@ -30,3 +31,4 @@ function hrpgSortTasks(User) {
});
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('popoverHtmlPopup', popoverHtmlPopup)
@@ -43,3 +44,4 @@ function loadPopupTemplate($templateCache) {
" </div>\n" +
"</div>\n");
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('popoverHtml', popoverHtml);
@@ -15,3 +16,4 @@ popoverHtml.$inject = [
function popoverHtml($compile, $timeout, $parse, $window, $tooltip) {
return $tooltip('popoverHtml', 'popover', 'click');
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('taskFocus', taskFocus);
@@ -22,3 +23,4 @@ function taskFocus($timeout) {
});
}
}
}());

View File

@@ -1,5 +1,6 @@
'use strict';
(function(){
angular
.module('habitrpg')
.directive('whenScrolled', whenScrolled);
@@ -15,3 +16,4 @@ function whenScrolled() {
});
};
}
}());