The code checks for the functions ```beforeRender``` and ```afterRender``` and if they exist they will be invoked.