Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created January 15, 2023 14:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save arun12209/27486e2a7d62f2c39d718b37cd0c1421 to your computer and use it in GitHub Desktop.
import { LightningElement } from 'lwc';
import { MessageContext, publish } from 'lightning/messageService';
import ACCOUNT_SELECTED from './accountSelected.js';
export default class MyComponent extends LightningElement {
@api recordId;
handleAccountSelect() {
const message = { recordId: this.recordId };
publish(this.messageContext, ACCOUNT_SELECTED, message);
}
connectedCallback() {
this.messageContext = MessageContext.getInstance();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment