Hello.
I need to make full page app of web application(not custom app).
I want when the contact or appointment update, reload full page app or web application.
I tried to full page app but can’t listener event.
The below is the code.
document.addEventListener("DOMContentLoaded", function () {
app.initialized().then(function (client) {
window.client = client;
client.events.on("app.activated", onAppActivate);
}).catch(handleErr);
});
function onAppActivate() {
var btn = document.querySelector('.btn-open');
btn.addEventListener('click', openModal);
// Start writing your code...
client.events.on('contact.update', contactUpdate, {intercept: true});
client.events.on('deal.update', dealUpdate, {intercept: true});
client.events.on('account.update', accountUpdate, {intercept: true});
}
function openModal() {
client.interface.trigger(
'showModal',
useTemplate('Title of the Modal', './views/modal.html')
);
}
function useTemplate(title, template) {
return {
title,
template
};
}
function contactUpdate(data) {
console.log('==> contactUpdate');
console.log(data);
}
function dealUpdate(data) {
console.log('==> dealUpdate');
console.log(data);
}
function accountUpdate(data){
console.log('==> accountUpdate');
console.log(data);
}
How I can listener event in full page app?