/**
 * 创建一个动态的 style 标签 append 到 body
 */
export default class FakeStyle {
  private tag!: HTMLStyleElement;
  constructor() {}
  create(innerHTML: string) {
    this.tag = this.tag || document.createElement('style');
    this.tag.innerHTML = innerHTML;
    if (!document.body.contains(this.tag)) document.body.appendChild(this.tag);
  }
  clear() {
    this.tag && (this.tag.innerHTML = '');
  }
}
