/// <summary> /// Inserts a css rule into the stylesheet. /// </summary> /// <param name="rule"></param> /// <param name="preserve">reserves the rule beyond a reset boundary.</param> public void InsertRule(string rule, bool preserve = false) { if (preserve) { this._preservedRules.Add(rule); } if (this._styleSheetConfig.InjectionMode != InjectionMode.None) { this._runtime?.InvokeAsync <object>(INJECT_RULE, rule, this._styleSheetConfig.InjectionMode, preserve); } else { this._rules.Add(rule); } RuleInserted?.Invoke(this, new StyleRuleInsertEventArgs(rule)); }
/// <summary> /// Inserts a css rule into the stylesheet. /// </summary> /// <param name="rule"></param> /// <param name="preserve">reserves the rule beyond a reset boundary.</param> public void InsertRule(string rule, bool preserve = false) { if (preserve) { this._preservedRules.Add(rule); } if (this._styleSheetConfig.InjectionMode != InjectionMode.None)// && JSRuntime.Current != null) { styleSheetRules.Add(rule); StyleEngine.CurrentStyleSubject.OnNext(styleSheetRules); //JSRuntime.Current.InvokeAsync<object>(INJECT_RULE, rule, this._styleSheetConfig.InjectionMode, preserve); } else { this._rules.Add(rule); } RuleInserted?.Invoke(this, new StyleRuleInsertEventArgs(rule)); }