public function get() { $content = $this->_js->compile(); if (!$this->_isDebug()) { $content = $this->_minify($content); } return $content; }
public function testCompileWithScope() { $container = new CM_Frontend_JavascriptContainer(); $container->append('foo()'); $container->append('bar()'); $this->assertSame("(function () { \n foo();\n bar()}).call(my_scope);", $container->compile('my_scope')); }
/** * @return string */ private function _getJs() { $treeInitJs = new CM_Frontend_JavascriptContainer(); $treeStoredJs = new CM_Frontend_JavascriptContainer(); foreach ($this->_getTreeNodes() as $node) { $treeInitJs->append($this->_getTreeNodeInitJs($node)); $treeStoredJs->append($this->_getTreeNodeStoredJs($node)); } $operations = array($this->_onloadHeaderJs->compile(), $treeInitJs->compile(), $this->_onloadPrepareJs->compile(), $treeStoredJs->compile(), $this->_onloadJs->compile(), $this->_onloadReadyJs->compile()); $operations = array_filter($operations); $code = implode(PHP_EOL, $operations); return $code; }