Skip to content

Instantly share code, notes, and snippets.

@hicglobalsolutions
Created April 4, 2024 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hicglobalsolutions/d353d330fb70bf218616b5fe258b0e39 to your computer and use it in GitHub Desktop.
Save hicglobalsolutions/d353d330fb70bf218616b5fe258b0e39 to your computer and use it in GitHub Desktop.
In the cloud_Pub_Sub.js file paste below code
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