aboutsummaryrefslogtreecommitdiffstats
path: root/include/classes/Debugging/Pagelet.php
blob: 9bae56e4e9eeda531ebc00af860c9a2ef6149c36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
namespace Debugging;

class Pagelet extends \BigPipe\Pagelet {
	public function __construct(string $id = NULL, int $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));
		}
	}
}