mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Add setOpenGraphMetaTag util function
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
This commit is contained in:
@@ -64,6 +64,16 @@ export async function toClipboard(text: string): Promise<void> {
|
||||
return navigator.clipboard.writeText(text);
|
||||
}
|
||||
|
||||
export function setOpenGraphMetaTag(data: {prop: string, content: string, attr?: string }[]): void {
|
||||
const elements = Array.from<HTMLElement>(document.querySelectorAll(`meta`));
|
||||
elements.forEach((element: any) => {
|
||||
let foundElement = data.find(data => {
|
||||
return data.prop === element.getAttribute(data.attr || 'property');
|
||||
});
|
||||
if (foundElement) element.content = foundElement.content;
|
||||
});
|
||||
}
|
||||
|
||||
export function toWei(amount: string): BigNumber {
|
||||
return parseUnits(amount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user