src/View.php
public function getJS($force_echo = false)
    {
        $actions = [];

        foreach ($this->_js_actions as $eventActions) {
            foreach ($eventActions as $action) {
                $actions[] = $action;
            }
        }

        if (!$actions) {
            return '';
        }

        $actions['indent'] = '';

        if (!$force_echo && $this->app && $this->app->hasMethod('jsReady')) {
            $this->app->jsReady($actions);

            return '';
        }

        // delegate $action rendering in hosting app if exist.
        if ($this->app && $this->app->hasMethod('getViewJS')) {
            return $this->app->getViewJS($actions);
        }

        $ready = new jsFunction($actions);

        return "<script>\n".
            (new jQuery($ready))->jsRender().
            '</script>';
    }
public function getJS($force_echo = false)
    {
        $actions = [];

        foreach ($this->_js_actions as $eventActions) {
            foreach ($eventActions as $action) {
                $actions[] = $action;
            }
        }

        if (!$actions) {
            return '';
        }

        $actions['indent'] = '';

        if (!$force_echo && $this->app && $this->app->hasMethod('jsReady')) {
            $this->app->jsReady($actions);

            return '';
        }

        // delegate $action rendering in hosting app if exist.
        if ($this->app && $this->app->hasMethod('getViewJS')) {
            return $this->app->getViewJS($actions);
        }

        $ready = new jsFunction($actions);

        return "<script>\n".
            (new jQuery($ready))->jsRender().
            '</script>';
    }
public function getJS ( $ force_echo = false ) { $ actions = [ ] ; foreach ( $ this -> _js_actions as $ eventActions ) { foreach ( $ eventActions as $ action ) { $ actions [ ] = $ action ; } } if ( ! $ actions ) { return '' ; } $ actions [ 'indent' ] = '' ; if ( ! $ force_echo && $ this -> app && $ this -> app -> hasMethod ( 'jsReady' ) ) { $ this -> app -> jsReady ( $ actions ) ; return '' ; } // delegate $action rendering in hosting app if exist. if ( $ this -> app && $ this -> app -> hasMethod ( 'getViewJS' ) ) { return $ this -> app -> getViewJS ( $ actions ) ; } $ ready = new jsFunction ( $ actions ) ; return "<script>\n" . ( new jQuery ( $ ready ) ) -> jsRender ( ) . '</script>' ; }
Get JavaScript objects from this render tree.

@param bool $force_echo

@return string
Get JavaScript objects from this render tree .