Is it possible to add pop up to confirm exit?

If a user accidentally exits without pressing the “Save” button at least once

import panel as pn
pn.extension()
button = pn.widgets.Button(name="Save")
# make sure save was clicked at least once; if not console.alert(?) about exiting