react-spinners
Version:
A collection of react loading spinners
15 lines (14 loc) • 583 B
JavaScript
export var createAnimation = function (loaderName, frames, suffix) {
var animationName = "react-spinners-".concat(loaderName, "-").concat(suffix);
if (typeof window == "undefined" || !window.document) {
return animationName;
}
var styleEl = document.createElement("style");
document.head.appendChild(styleEl);
var styleSheet = styleEl.sheet;
var keyFrames = "\n @keyframes ".concat(animationName, " {\n ").concat(frames, "\n }\n ");
if (styleSheet) {
styleSheet.insertRule(keyFrames, 0);
}
return animationName;
};