'use strict';
/** Perform some action
* @module exampleSite
*/
import * as SomeUtil from '../../utility/some-util';
//
// Definitions
//
/** Possible colors
*
* > This array **must not** be edited because some other file relies on it
* having *N* properties with *N* values. It's dumb, but history often is such.
* @enum {number}
*/
const colors = {
BLUE: 'indigo',
RED: 'crimson',
GREEN: 'seagreen',
/** Fallback value
* @type {?number} */
DEFAULT: 'seagreen',
/** @type {null} */
IGNORE: null
};
//
// Exports
//
/**
* Whether the page should glow
* @private
* @param {string} color - The referring site
* @return {boolean}
*/
export function _shouldGlow(color) {
// Amazing code goes here
const shouldGlow = SomeUtil.someMethod(color);
return shouldGlow;
}
// FE-2453: Use a function name; remove this comment; remove lint disabling
/** Make the page glow (color depends on external resource)
*
* Design did not define glow. We made all the divs have a box shadow.
* Design did not complain. No revisit was scheduled. So, here we are.
*/
export function f() { // eslint-disable-line id-length
// FAQ: Why not just make the `DEFUALT` be `transparent`?
// Because of historical reasons that are described by `colors`.
const defaultColor = (colors.DEFAULT === colors.NULL) ? 'transparent' : colors.DEFAULT;
const color = (window.color === undefined) ? defaultColor : window.color;
const shouldGlow = _shouldGlow(color);
if (shouldGlow) {
document.write('<style id="example-site">div { box-shadow: inset 0 0 10px ' + color + '; }</style>');
}
}