Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 15, 2023 14:07
Show Gist options
  • Save arun12209/21a2a66d5a949e18d420f4da3304e3a0 to your computer and use it in GitHub Desktop.
Save arun12209/21a2a66d5a949e18d420f4da3304e3a0 to your computer and use it in GitHub Desktop.
<template>
<button onclick={handleClick}>Click me</button>
</template>
<script>
import { LightningElement } from 'lwc';
export default class EventFiringComponent extends LightningElement {
handleClick() {
const event = new CustomEvent('myevent', { detail: { message: 'Hello World' } });
this.dispatchEvent(event);
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment