aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2018-01-16 12:23:29 +0100
committerThomas Lange <code@nerdmind.de>2018-01-16 12:23:29 +0100
commitb20d9dcac191fadc671da69f0a82ab7065554ca6 (patch)
tree2f17e1ef6486d663830fd111509d596e8f374772
parent06aeab16754bcab59a943192e7137852e2f89e4a (diff)
downloadbigpipe-b20d9dcac191fadc671da69f0a82ab7065554ca6.tar.gz
bigpipe-b20d9dcac191fadc671da69f0a82ab7065554ca6.tar.xz
bigpipe-b20d9dcac191fadc671da69f0a82ab7065554ca6.zip
Add debugging classes for Pagelet, Stylesheet and Javascript
-rw-r--r--include/classes/Debugging/Pagelet.php14
-rw-r--r--include/classes/Debugging/Resource/Javascript.php14
-rw-r--r--include/classes/Debugging/Resource/Stylesheet.php14
3 files changed, 42 insertions, 0 deletions
diff --git a/include/classes/Debugging/Pagelet.php b/include/classes/Debugging/Pagelet.php
new file mode 100644
index 0000000..a06ff4c
--- /dev/null
+++ b/include/classes/Debugging/Pagelet.php
@@ -0,0 +1,14 @@
+<?php
+namespace Debugging;
+
+class Pagelet extends \BigPipe\Pagelet {
+ public function __construct($customID = NULL, $priority = self::PRIORITY_NORMAL) {
+ parent::__construct(...func_get_args());
+
+ foreach(['INIT', 'LOADCSS', 'HTML', 'LOADJS', 'DONE'] as $phase) {
+ $code = 'console.log("PhaseDoneJS for Pagelet %%c#%s%%c: %s", "color:#008B45", "color:inherit")';
+ $this->addPhaseDoneJS(constant("self::PHASE_$phase"), sprintf($code, $this->getID(), $phase));
+ }
+ }
+}
+?> \ No newline at end of file
diff --git a/include/classes/Debugging/Resource/Javascript.php b/include/classes/Debugging/Resource/Javascript.php
new file mode 100644
index 0000000..b8d5bc3
--- /dev/null
+++ b/include/classes/Debugging/Resource/Javascript.php
@@ -0,0 +1,14 @@
+<?php
+namespace Debugging\Resource;
+
+class Javascript extends \BigPipe\Resource\Javascript {
+ public function __construct($customID = NULL, $resourceURL) {
+ parent::__construct(...func_get_args());
+
+ foreach(['INIT', 'LOAD', 'DONE'] as $phase) {
+ $code = 'console.log("PhaseDoneJS for Javascript %%c#%s%%c: %s", "color:#B24A4A", "color:inherit")';
+ $this->addPhaseDoneJS(constant("self::PHASE_$phase"), sprintf($code, $this->getID(), $phase));
+ }
+ }
+}
+?> \ No newline at end of file
diff --git a/include/classes/Debugging/Resource/Stylesheet.php b/include/classes/Debugging/Resource/Stylesheet.php
new file mode 100644
index 0000000..7d9c8d8
--- /dev/null
+++ b/include/classes/Debugging/Resource/Stylesheet.php
@@ -0,0 +1,14 @@
+<?php
+namespace Debugging\Resource;
+
+class Stylesheet extends \BigPipe\Resource\Stylesheet {
+ public function __construct($customID = NULL, $resourceURL) {
+ parent::__construct(...func_get_args());
+
+ foreach(['INIT', 'LOAD', 'DONE'] as $phase) {
+ $code = 'console.log("PhaseDoneJS for Stylesheet %%c#%s%%c: %s", "color:#4169E1", "color:inherit")';
+ $this->addPhaseDoneJS(constant("self::PHASE_$phase"), sprintf($code, $this->getID(), $phase));
+ }
+ }
+}
+?> \ No newline at end of file