public function onWriteOnce($cb) { if (!$this->writing) { $cb($this); return; } $this->onWriteOnce->push($cb); }