componentDidMount() { LCC.addMessageHandler(this.onMessage); } onMessage(msg) { let name = msg.name; if (name === "General") { let value = msg.value; this.setState({messageReceived: value}); } else if (name === "Foo") { // A different response } }
You can view and download this example in the Developerforce Github Repository.
Name | Type | Description |
---|---|---|
handler: (userMsg: any) => void | function | The function that handles messages sent from the Lightning component. |
None.