Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onCreateRule(name?: string, decl: JssStyle, options: RuleOptions): Rule | null {
if (!isObservable(decl)) return null
// Cast `decl` to `Observable`, since it passed the type guard.
const style$ = (decl: Observable<{[string]: string | number}>)
const rule = ((createRule(name, {}, options): any): StyleRule)
// TODO
// Call `stream.subscribe()` returns a subscription, which should be explicitly
// unsubscribed from when we know this sheet is no longer needed.
style$.subscribe((style: JssStyle) => {
for (const prop in style) {
rule.prop(prop, style[prop], updateOptions)
}
})
return rule
},
onCreateRule(name?: string, decl: JssStyle, options: RuleOptions): Rule | null {
if (typeof decl !== 'function') return null
const rule: StyleRuleWithRuleFunction = (createRule(name, {}, options): any)
rule[fnRuleNs] = decl
return rule
},