diff options
Diffstat (limited to 'include/classes/BigPipe/BigPipe.php')
-rwxr-xr-x | include/classes/BigPipe/BigPipe.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/include/classes/BigPipe/BigPipe.php b/include/classes/BigPipe/BigPipe.php index 740d047..63cb711 100755 --- a/include/classes/BigPipe/BigPipe.php +++ b/include/classes/BigPipe/BigPipe.php @@ -7,31 +7,31 @@ class BigPipe { private static $pagelets = []; private static $count = 0; - #==================================================================================================== + #=============================================================================== # Return TRUE if the pipeline is enabled - #==================================================================================================== + #=============================================================================== public static function isEnabled() { return self::$enabled; } - #==================================================================================================== + #=============================================================================== # Enable or disable the pipeline mode - #==================================================================================================== + #=============================================================================== public static function enablePipeline($enabled = TRUE) { return self::$enabled = (bool) $enabled; } - #==================================================================================================== + #=============================================================================== # Add a new pagelet to pipeline - #==================================================================================================== + #=============================================================================== public static function addPagelet(Pagelet $Pagelet, $priority) { self::$pagelets[$priority][] = $Pagelet; return ++self::$count; } - #==================================================================================================== + #=============================================================================== # Prints a single pagelet response - #==================================================================================================== + #=============================================================================== private static function singleResponse(Pagelet $Pagelet, $last = FALSE) { $data = [ 'ID' => $Pagelet->getID(), @@ -47,19 +47,19 @@ class BigPipe { $pageletJSON = json_encode($data, (self::$debug ? JSON_PRETTY_PRINT : FALSE)); echo "<code class=\"hidden\" id=\"_{$Pagelet->getID()}\"><!-- {$pageletHTML} --></code>\n"; - echo "<script>BigPipe.onPageletArrive({$pageletJSON});</script>\n\n"; + echo "<script>BigPipe.onPageletArrive({$pageletJSON}, (document.getElementById(\"_{$Pagelet->getID()}\")));</script>\n\n"; } - #==================================================================================================== + #=============================================================================== # Sends output buffer so far as possible towards user - #==================================================================================================== + #=============================================================================== public static function flushOutputBuffer() { ob_flush(); flush(); } - #==================================================================================================== + #=============================================================================== # Render the pagelets - #==================================================================================================== + #=============================================================================== public static function render() { self::flushOutputBuffer(); |