There are Yii widgets that generate JavaScript code for tasks like ajax updates. This code is often placed at the end of the page by Yii. I am interested in having Yii's ClientScript::registerScript() function place this code in external files and link them in the document instead. What would be the most effective way to achieve this?