Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
/* Didn't notice any perf improvement with memozing this, actually saw a regression
memoized custom property check, may see improvement if called more frequently */
const customPropertyCheck = () => {
let cache = {};
return () => {
if ('customProperties' in cache) {
console.log('Fetching from cache');
return cache['customProperties'];
else {
console.log('Calculating result');
let result = window.CSS && CSS.supports("color", "var(--color)");
cache['customProperties'] = result;
return result;
const cp = customPropertyCheck();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.