aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/BigPipe/Pagelet.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/classes/BigPipe/Pagelet.php')
-rw-r--r--include/classes/BigPipe/Pagelet.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/classes/BigPipe/Pagelet.php b/include/classes/BigPipe/Pagelet.php
index ae465ab..101ec34 100644
--- a/include/classes/BigPipe/Pagelet.php
+++ b/include/classes/BigPipe/Pagelet.php
@@ -148,6 +148,24 @@ class Pagelet extends Item {
}
#===============================================================================
+ # Flush pagelet immediately
+ #===============================================================================
+ public function flush() {
+ if(BigPipe::enabled()) {
+ $pageletHTML = removeLineBreaksAndTabs($this->getHTML());
+ $pageletHTML = str_replace('--', '--', $pageletHTML);
+
+ $pageletJSON = json_encode($this->getStructure());
+
+ echo "<code hidden id=\"_{$this->getID()}\"><!-- {$pageletHTML} --></code>\n";
+ echo "<script>BigPipe.onPageletArrive({$pageletJSON}, document.getElementById(\"_{$this->getID()}\"));</script>\n\n";
+
+ BigPipe::dequeue($this);
+ BigPipe::flushOutputBuffer();
+ }
+ }
+
+ #===============================================================================
# Magic method: __toString()
#===============================================================================
public function __toString() {