Commit ad070e9f authored by Robert Knight's avatar Robert Knight

Give names to some anonymous functions assigned to `module.exports`

This is mostly to make it easier for the convert-to-es-modules script to
preserve comments when these modules are converted to ES modules.
However it may also be useful for debugging.
parent d8f9baae
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
* <input ng-if="..." h-autofocus> * <input ng-if="..." h-autofocus>
* *
*/ */
module.exports = function() { function autofocusDirective() {
return { return {
restrict: 'A', restrict: 'A',
link: function($scope, $element) { link: function($scope, $element) {
$element[0].focus(); $element[0].focus();
}, },
}; };
}; }
module.exports = autofocusDirective;
...@@ -28,7 +28,7 @@ function addEventHandler($scope, element, events, handler) { ...@@ -28,7 +28,7 @@ function addEventHandler($scope, element, events, handler) {
* mouse press OR touch. * mouse press OR touch.
*/ */
// @ngInject // @ngInject
module.exports = function($parse) { function onTouchDirective($parse) {
return { return {
restrict: 'A', restrict: 'A',
link: function($scope, $element, $attrs) { link: function($scope, $element, $attrs) {
...@@ -41,4 +41,6 @@ module.exports = function($parse) { ...@@ -41,4 +41,6 @@ module.exports = function($parse) {
); );
}, },
}; };
}; }
module.exports = onTouchDirective;
...@@ -77,7 +77,7 @@ function Tooltip(rootElement) { ...@@ -77,7 +77,7 @@ function Tooltip(rootElement) {
* *
* Example: '<button aria-label="Tooltip label" h-tooltip></button>' * Example: '<button aria-label="Tooltip label" h-tooltip></button>'
*/ */
module.exports = function() { function tooltipDirective() {
if (!theTooltip) { if (!theTooltip) {
theTooltip = new Tooltip(document.body); theTooltip = new Tooltip(document.body);
} }
...@@ -107,4 +107,6 @@ module.exports = function() { ...@@ -107,4 +107,6 @@ module.exports = function() {
}); });
}, },
}; };
}; }
module.exports = tooltipDirective;
module.exports = function() { function windowScrollDirective() {
return { return {
link: function(scope, elem, attr) { link: function(scope, elem, attr) {
let active = true; let active = true;
...@@ -25,4 +25,6 @@ module.exports = function() { ...@@ -25,4 +25,6 @@ module.exports = function() {
}); });
}, },
}; };
}; }
module.exports = windowScrollDirective;
let loaded = false; let loaded = false;
module.exports = function(trackingId) { function loadGoogleAnalytics(trackingId) {
// small measure to make we do not accidentally // small measure to make we do not accidentally
// load the analytics scripts more than once // load the analytics scripts more than once
if (loaded) { if (loaded) {
...@@ -46,4 +46,6 @@ module.exports = function(trackingId) { ...@@ -46,4 +46,6 @@ module.exports = function(trackingId) {
ga('set', 'anonymizeIp', true); ga('set', 'anonymizeIp', true);
/* eslint-enable */ /* eslint-enable */
}; }
module.exports = loadGoogleAnalytics;
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* @param {Function} fn - Callback to invoke with setTimeout * @param {Function} fn - Callback to invoke with setTimeout
* @param {number} delay - Delay argument to pass to setTimeout * @param {number} delay - Delay argument to pass to setTimeout
*/ */
module.exports = function($scope, fn, delay, setTimeoutFn, clearTimeoutFn) { function scopeTimeout($scope, fn, delay, setTimeoutFn, clearTimeoutFn) {
setTimeoutFn = setTimeoutFn || setTimeout; setTimeoutFn = setTimeoutFn || setTimeout;
clearTimeoutFn = clearTimeoutFn || clearTimeout; clearTimeoutFn = clearTimeoutFn || clearTimeout;
...@@ -23,4 +23,6 @@ module.exports = function($scope, fn, delay, setTimeoutFn, clearTimeoutFn) { ...@@ -23,4 +23,6 @@ module.exports = function($scope, fn, delay, setTimeoutFn, clearTimeoutFn) {
removeDestroyHandler = $scope.$on('$destroy', function() { removeDestroyHandler = $scope.$on('$destroy', function() {
clearTimeoutFn(id); clearTimeoutFn(id);
}); });
}; }
module.exports = scopeTimeout;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment