Add lifecycle event handlers