Make attachToShadow an async function

This commit is contained in:
Henrik Giesel 2022-08-01 02:08:25 +02:00
parent 3aba3772aa
commit b62705eadf

View file

@ -47,16 +47,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
} as StyleLinkType, } as StyleLinkType,
]; ];
function attachToShadow(element: Element) { async function attachToShadow(element: Element): Promise<void> {
const customStyles = new CustomStyles({ const customStyles = new CustomStyles({
target: element.shadowRoot as any, target: element.shadowRoot as any,
props: { styles }, props: { styles },
}); });
customStyles.addStyleTag("userBase").then((styleTag) => { const styleTag = await customStyles.addStyleTag("userBase");
userBaseResolve(styleTag); userBaseResolve(styleTag);
callback(customStyles); callback(customStyles);
});
} }
</script> </script>