public Worker(IChannelOwner parent, string guid, WorkerInitializer initializer) : base(parent, guid) { _channel = new WorkerChannel(guid, parent.Connection, this); _initializer = initializer; _channel.Closed += (sender, e) => { if (Page != null) { Page.WorkersList.Remove(this); } if (BrowserContext != null) { BrowserContext.ServiceWorkersList.Remove(this); } Close?.Invoke(this, EventArgs.Empty); }; }