document IPC broadcast

This commit is contained in:
Joao Moreno 2020-02-03 12:06:51 +01:00
parent b4663d82e9
commit 929d775aad
No known key found for this signature in database
GPG key ID: 9494F5E6167A8E6B

View file

@ -731,10 +731,17 @@ export class IPCServer<TContext = string> implements IChannelServer<TContext>, I
listen(eventName: string, arg: any): Event<T> {
let disposables = new DisposableStore();
// Create an emitter which hooks up to all clients
// as soon as first listener is added. It also
// disconnects from all clients as soon as the last listener
// is removed.
const emitter = new Emitter<T>({
onFirstListenerAdd: () => {
disposables = new DisposableStore();
// The event multiplexer is useful since the active
// client list is dynamic. We need to hook up and disconnection
// to/from clients as they come and go.
const eventMultiplexer = new EventMultiplexer<T>();
const map = new Map<Connection<TContext>, IDisposable>();