public function __construct(array $defaultAttributes = [], LoopInterface $loop = null)
{
$this->window = $window = new Window([], null, $this);
$this->loop = $loop ?: Factory::create();
$this->on('start', function () use($window, $defaultAttributes) {
foreach ($defaultAttributes as $attr => $value) {
$method = 'set' . ucfirst($attr);
if (method_exists($window, $method)) {
$window->{$method}($value);
}
}
});
}