From 21824df56bd13d81f10ac0b86c5cad31def51f3e Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sat, 25 Jun 2016 15:34:34 +0200 Subject: Update with new features and code improvements. + New classes have been added: "BigPipe\Resource", "BigPipe\Resource\CSS", "BigPipe\Resource\JS". If you wan't to add a resource to a Pagelet, you can now built a new resource object with the "CSS" or "JS" class (the "Resource" class is abstract and the parent class of "CSS" and "JS") and can add PhaseDoneJS callbacks for this resources with "Resource::addPhaseDoneJS()" similar to "Pagelet::addPhaseDoneJS()". To add the resource to your pagelet: "$Pagelet->addResource($Resource)". Of course, you can still use the two SHORT methods "Pagelet::addCSS()" and "Pagelet::addJS()" which needs only one parameter with the resource URL. + Each resource has now PhaseDoneJS callbacks for 3 phases (Object initializied [INIT], Loading started [LOAD], Loading complete [DONE]). + Check your usage of the PhaseDoneJS callback constants of the Pagelet class: These constants have been renamed. + Debugging mode: Just set BigPipe::debugging(TRUE) and each pagelet and resource will be pass through a function which adds PhaseDoneJS callbacks with debug informations (Look now at the Javascript console and enjoy the beautiful colors which makes the debug informations better readable for your eyes. \(o_o)/). + Several code improvements on almost all files. --- include/pagelets.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'include/pagelets.php') diff --git a/include/pagelets.php b/include/pagelets.php index 176bc74..9725879 100644 --- a/include/pagelets.php +++ b/include/pagelets.php @@ -1,8 +1,13 @@ addHTML('
I AM A PAGELET WITH RED BACKGROUND
'); $PageletRed->addCSS('static/red.php'); $PageletRed->addCSS('static/red.php'); @@ -12,7 +17,7 @@ $PageletRed->addJSCode("document.getElementById('red').innerHTML += ' [JS execut #=============================================================================== # Pagelet with blue background color #=============================================================================== -$PageletBlue = new BigPipe\DemoPagelet('bluePL', BigPipe\Pagelet::PRIORITY_HIGH); +$PageletBlue = new BigPipe\Pagelet('bluePL', BigPipe\Pagelet::PRIORITY_HIGH); $PageletBlue->addHTML('
I AM A PAGELET WITH BLUE BACKGROUND
'); $PageletBlue->addCSS('static/blue.php'); $PageletRed->addCSS('static/red.php'); @@ -22,7 +27,7 @@ $PageletBlue->addJSCode("document.getElementById('blue').innerHTML += ' [JS exec #=============================================================================== # Pagelet with green background color #=============================================================================== -$PageletGreen = new BigPipe\DemoPagelet('greenPL'); +$PageletGreen = new BigPipe\Pagelet('greenPL'); { #=============================================================================== @@ -39,7 +44,7 @@ $PageletGreen = new BigPipe\DemoPagelet('greenPL'); // the first which arrives, but it will first be displayed if his dependency // pagelets are already displayed. - $InnerPagelet = new BigPipe\DemoPagelet('innerPL', BigPipe\Pagelet::PRIORITY_HIGHEST, [$PageletGreen->getID()]); + $InnerPagelet = new BigPipe\Pagelet('innerPL', BigPipe\Pagelet::PRIORITY_HIGHEST, [$PageletGreen->getID()]); $InnerPagelet->addHTML('
Inner Pagelet \(o_o)/
'); } -- cgit v1.2.3