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 @@
* <input ng-if="..." h-autofocus>
*
*/
module.exports = function() {
function autofocusDirective() {
return {
restrict: 'A',
link: function($scope, $element) {
$element[0].focus();
},
};
};
}
module.exports = autofocusDirective;
......@@ -28,7 +28,7 @@ function addEventHandler($scope, element, events, handler) {
* mouse press OR touch.
*/
// @ngInject
module.exports = function($parse) {
function onTouchDirective($parse) {
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
......@@ -41,4 +41,6 @@ module.exports = function($parse) {
);
},
};
};
}
module.exports = onTouchDirective;
......@@ -77,7 +77,7 @@ function Tooltip(rootElement) {
*
* Example: '<button aria-label="Tooltip label" h-tooltip></button>'
*/
module.exports = function() {
function tooltipDirective() {
if (!theTooltip) {
theTooltip = new Tooltip(document.body);
}
......@@ -107,4 +107,6 @@ module.exports = function() {
});
},
};
};
}
module.exports = tooltipDirective;
module.exports = function() {
function windowScrollDirective() {
return {
link: function(scope, elem, attr) {
let active = true;
......@@ -25,4 +25,6 @@ module.exports = function() {
});
},
};
};
}
module.exports = windowScrollDirective;
let loaded = false;
module.exports = function(trackingId) {
function loadGoogleAnalytics(trackingId) {
// small measure to make we do not accidentally
// load the analytics scripts more than once
if (loaded) {
......@@ -46,4 +46,6 @@ module.exports = function(trackingId) {
ga('set', 'anonymizeIp', true);
/* eslint-enable */
};
}
module.exports = loadGoogleAnalytics;
......@@ -11,7 +11,7 @@
* @param {Function} fn - Callback to invoke with 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;
clearTimeoutFn = clearTimeoutFn || clearTimeout;
......@@ -23,4 +23,6 @@ module.exports = function($scope, fn, delay, setTimeoutFn, clearTimeoutFn) {
removeDestroyHandler = $scope.$on('$destroy', function() {
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