example code for template lifecycle callbacks (#19)