Skip to content

Commit

Permalink
refactor(ripple): format ripple file
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 568373829
  • Loading branch information
codr authored and copybara-github committed Sep 26, 2023
1 parent 2528c1c commit 12381f1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/mdc-ripple/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

import {MDCRipplePoint} from './types';

/**
* Stores result from supportsCssVariables to avoid redundant processing to
* detect CSS custom variable support.
*/
let supportsCssVariables_: boolean|undefined;
let supportsCssVariablesCache: boolean|undefined;

/** Checks if the window supports CSS Variables */
export function supportsCssVariables(
windowObj: typeof globalThis, forceRefresh = false): boolean {
const {CSS} = windowObj;
let supportsCssVars = supportsCssVariables_;
if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
return supportsCssVariables_;
let supportsCssVars = supportsCssVariablesCache;
if (typeof supportsCssVariablesCache === 'boolean' && !forceRefresh) {
return supportsCssVariablesCache;
}

const supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
Expand All @@ -51,11 +53,12 @@ export function supportsCssVariables(
explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;

if (!forceRefresh) {
supportsCssVariables_ = supportsCssVars;
supportsCssVariablesCache = supportsCssVars;
}
return supportsCssVars;
}

/** Gets the normalized events coordinates */
export function getNormalizedEventCoords(
event: Event|undefined, pageOffset: MDCRipplePoint,
clientRect: DOMRect): MDCRipplePoint {
Expand Down

0 comments on commit 12381f1

Please sign in to comment.