Created
April 4, 2024 13:07
-
-
Save hicglobalsolutions/d353d330fb70bf218616b5fe258b0e39 to your computer and use it in GitHub Desktop.
In the cloud_Pub_Sub.js file paste below code
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
import { LightningElement, track } from 'lwc'; | |
import pullMessages from '@salesforce/apex/GoogleCloudPubSubService.pullMessages'; | |
export default class Cloud_Pub_Sub extends LightningElement { | |
@track messages = []; | |
getMessages() { | |
console.log('onclick'); | |
try { | |
pullMessages() | |
.then(result => { | |
this.messages = result; | |
console.log('got message', this.messages); | |
}) | |
.catch(error => { | |
console.error('Error in pullMessages: ', error); | |
}); | |
} catch (e) { | |
console.error('Error in getMessages: ', e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment