From b22ba9e927e6d8bcbd21c860f55efb556596dff3 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Thu, 17 Oct 2024 05:55:36 +0200 Subject: [PATCH] added tips to README.md Signed-off-by: StoneyDSP --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 764c44a..3c5639f 100644 --- a/README.md +++ b/README.md @@ -314,12 +314,12 @@ const button = Button(); // example const CustomButton = (): HTMLButtonElement => { - class CustomButton extends HTMLButtonElement { + class CustomButtonElement extends HTMLButtonElement { constructor() { super(); } } - customElements.define('custom-button', CustomButton) + customElements.define('custom-button', CustomButtonElement) return document.createElement<'button'>('button'); }; @@ -337,13 +337,13 @@ type CustomButtonProps = { }; const CustomButton = (props: CustomButtonProps): HTMLButtonElement => { - class CustomButton extends HTMLButtonElement { + class CustomButtonElement extends HTMLButtonElement { constructor() { super(); this.type = props.type; } } - customElements.define('custom-button', CustomButton); + customElements.define('custom-button', CustomButtonElement); return document.createElement<'button'>('button'); }; @@ -362,14 +362,14 @@ type CustomButtonProps = { }; const CustomButton = (props: CustomButtonProps): HTMLButtonElement => { - class CustomButton extends HTMLButtonElement { + class CustomButtonElement extends HTMLButtonElement { constructor() { super(); this.type = props.type; if (props.children) this.appendChild(props.children); } } - customElements.define('custom-button', CustomButton); + customElements.define('custom-button', CustomButtonElement); return document.createElement<'button'>('button'); }; @@ -390,7 +390,7 @@ type CustomButtonProps = { }; const CustomButton = (props: CustomButtonProps): HTMLButtonElement => { - class CustomButton extends HTMLButtonElement { + class CustomButtonElement extends HTMLButtonElement { constructor() { super(); this.type = props.type; @@ -398,7 +398,7 @@ const CustomButton = (props: CustomButtonProps): HTMLButtonElement => { if (props.className) this.className = props.className; } } - customElements.define('custom-button', CustomButton); + customElements.define('custom-button', CustomButtonElement); return document.createElement<'button'>('button'); };