Ferreteria/v0.6/clade/IO/Aspect/Connx/Stream/aux/Updater
Jump to navigation
Jump to search
| ||||||||||||||||||||
About
History
- 2026-02-19 created
- 2026-03-04 moved from Stream/Finite/Buffer/aux to Stream/aux, because it's really about any type of Stream
- 2026-03-08 (I think) reorganized -- now takes a single Stream, not a pair; also goes directly to
Panel, rather than going throughCableclass
Code
interface iUpdater extends BaseIface {}
class cUpdater extends BaseClass implements iUpdater {
// ++ SETUP ++ //
public static function FromStream(StreamIface $o) : iUpdater {
$oThis = new static;
$oThis->WithStream($o);
return $oThis;
}
// ++ SETUP: dynamic ++ //
private $oStream;
protected function WithStream(StreamIface $o) { $this->oStream = $o; }
// -- SETUP -- //
// ++ STATE ++ //
private $sSfx = NULL;
public function Suffix(?string $s) : string { return is_string($s) ? ($this->sSfx = $s) : $this->sSfx; }
// -- STATE -- //
// ++ EVENTS ++ //
// CEMENT
public function OnBefore() { // called before starting main loop
$oPanel = $this->OPanel();
$oPanel->OnBefore();
}
// CEMENT
public function OnIterate() { // called every time something changed
$sMsg = $this->OStream()->DescribeInline();
$oPanel = $this->OPanel();
$oPanel->Message($sMsg);
$oPanel->OnIterate();
}
// CEMENT
public function OnAfter() { // called when there will be no more updates (so always update the display)
$oPanel = $this->OPanel();
$oPanel->OnAfter();
}
// -- EVENTS -- //
// ++ OBJECTS ++ //
protected function OPanel() : PanelIface { return AppAdmin::Me()->OPanel(); }
protected function OStream() : StreamIface { return $this->oStream; }
// -- OBJECTS -- //
}