Added custom onTemplateReady JS event