// A simple plugin that stores the history of scan durations
function init() {
$app.onScanCompleted((e) => {
// Store the scanning duration (in ms)
$store.set("scan-completed", e.duration)
e.next()
})
$ui.register((ctx) => {
// Callback is triggered when the value is updated
$store.watch<number>("scan-completed", (value) => {
const now = new Date().toISOString().replaceall(".", "_")
$storage.set("scan-duration-history."+now, value)
ctx.toast.info(`Scanning took ${value/1000} seconds!`)
})
})
}