@figliolia/ripples
Version:
WebGL ripples based on the clever work of Pim Schreurs
26 lines (25 loc) • 750 B
JavaScript
export class StyleCache extends Map {
constructor() {
super([
["zIndex", ""],
["position", ""],
["backgroundWidth", 0],
["backgroundHeight", 0],
["originalInlineCSS", ""],
["originalCSSBackgroundImage", ""],
]);
}
initialize(target) {
const { position, zIndex, backgroundImage } = window.getComputedStyle(target);
this.set("zIndex", zIndex);
this.set("position", position);
this.set("originalCSSBackgroundImage", backgroundImage);
this.set("originalInlineCSS", target.style.backgroundImage);
}
get(key) {
return super.get(key);
}
evict(key) {
return super.set(key, "");
}
}