Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error(`Cannot fetch app ${app.slug}: ${error.message}`)
}
if (typeof onCreate === 'function') {
onCreate(fullApp)
}
}
const handleAppRemoval = app => {
if (typeof onDelete === 'function') {
onDelete(app)
}
}
try {
const realtime = new CozyRealtime({ client: cozyClient })
realtime.subscribe('created', APPS_DOCTYPE, handleAppCreation)
realtime.subscribe('deleted', APPS_DOCTYPE, handleAppRemoval)
} catch (error) {
// eslint-disable-next-line no-console
console.warn(`Cannot initialize realtime in Cozy-bar: ${error.message}`)
}
}
ensureRealtime() {
if (this.realtime) {
return
}
const client = this.props.client
this.realtime = new CozyRealtime({ client })
}
followJob(job) {
const rt = new Realtime({ client: this.props.client })
this.unfollowJob = subscribe(
rt,
'updated',
'io.cozy.jobs',
job._id,
this.handleJobChange
)
}