import { patron, sourceAll, sourceChangeable, SourceType, value, } from "silentium"; /** * Helps to get HTMLElement from html string */ export const jsDomElement = ( documentSrc: SourceType, htmlSrc: SourceType, ) => { const result = sourceChangeable(); const all = sourceAll<[Document, string]>([documentSrc, htmlSrc]); value( all, patron(([document, html]) => { const div = document.createElement("div"); div.innerHTML = html; result.give(div.children[0] as HTMLElement); }), ); return result; };