framework/web/View.php
public function registerJs($js, $position = self::POS_READY, $key = null)
    {
        $key = $key ?: md5($js);
        $this->js[$position][$key] = $js;
        if ($position === self::POS_READY || $position === self::POS_LOAD) {
            JqueryAsset::register($this);
        }
    }
public function registerJs($js, $position = self::POS_READY, $key = null)
    {
        $key = $key ?: md5($js);
        $this->js[$position][$key] = $js;
        if ($position === self::POS_READY || $position === self::POS_LOAD) {
            JqueryAsset::register($this);
        }
    }
public function registerJs ( $ js , $ position = self :: POS_READY , $ key = null ) { $ key = $ key ? : md5 ( $ js ) ; $ this -> js [ $ position ] [ $ key ] = $ js ; if ( $ position === self :: POS_READY || $ position === self :: POS_LOAD ) { JqueryAsset :: register ( $ this ) ; } }
Registers a JS code block.
@param string $js the JS code block to be registered
@param int $position the position at which the JS script tag should be inserted
in a page. The possible values are:

- [[POS_HEAD]]: in the head section
- [[POS_BEGIN]]: at the beginning of the body section
- [[POS_END]]: at the end of the body section
- [[POS_LOAD]]: enclosed within jQuery(window).load().
Note that by using this position, the method will automatically register the jQuery js file.
- [[POS_READY]]: enclosed within jQuery(document).ready(). This is the default value.
Note that by using this position, the method will automatically register the jQuery js file.

@param string $key the key that identifies the JS code block. If null, it will use
$js as the key. If two JS code blocks are registered with the same key, the latter
will overwrite the former.
Registers a JS code block . @param string $js the JS code block to be registered @param int $position the position at which the JS script tag should be inserted in a page . The possible values are :