-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b08a5b
commit 056ed3e
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
LitElement, | ||
css, | ||
html, | ||
type CSSResultGroup, | ||
type TemplateResult | ||
} from 'lit' | ||
import {customElement, property} from 'lit/decorators.js' | ||
import {Bubble} from '../bubble.js' | ||
|
||
declare global { | ||
interface HTMLElementEventMap { | ||
'fancy-click': CustomEvent<FancyClick> | ||
} | ||
interface HTMLElementTagNameMap { | ||
'play-demo': PlayDemo | ||
} | ||
} | ||
|
||
export type FancyClick = {num: number} | ||
|
||
@customElement('play-demo') | ||
export class PlayDemo extends LitElement { | ||
@property({attribute: false}) example?: string | ||
|
||
static override styles: CSSResultGroup = css`` | ||
|
||
protected override render(): TemplateResult { | ||
return html`<button | ||
@click=${() => { | ||
console.log('hello! button clicked!') | ||
this.dispatchEvent( | ||
Bubble<FancyClick>('fancy-click', {num: Math.random()}) | ||
) | ||
}} | ||
> | ||
hello! | ||
</button>` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters