• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

streetsidesoftware / cspell / 21252697500

22 Jan 2026 02:45PM UTC coverage: 92.828% (+0.003%) from 92.825%
21252697500

Pull #8423

github

web-flow
Merge 73181995e into d639a823b
Pull Request #8423: fix: Add NotifyEmitter

8864 of 10610 branches covered (83.54%)

33 of 35 new or added lines in 2 files covered. (94.29%)

17705 of 19073 relevant lines covered (92.83%)

31595.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/packages/cspell-lib/src/rpc/MessagePortEvents.ts
1
import type { MessagePortLike } from './messagePort.js';
2
import type { NotifyEvent } from './notify.js';
3
import { NotifyEmitter } from './notify.js';
4

5
export class MessagePortEvents {
6
    #notifyMessage: NotifyEmitter<unknown> = new NotifyEmitter();
1✔
7
    #notifyClose: NotifyEmitter<Event> = new NotifyEmitter();
1✔
8
    #notifyMessageError: NotifyEmitter<Error> = new NotifyEmitter();
1✔
9
    #port: MessagePortLike;
10

11
    constructor(port: MessagePortLike) {
12
        this.#port = port;
1✔
13
        this.#port.addListener('message', this.#notifyMessage.notify);
1✔
14
        this.#port.addListener('messageerror', this.#notifyMessageError.notify);
1✔
15
        this.#port.addListener('close', this.#notifyClose.notify);
1✔
16
    }
17

18
    [Symbol.dispose](): void {
19
        this.#port.removeListener('message', this.#notifyMessage.notify);
1✔
20
        this.#port.removeListener('messageerror', this.#notifyMessageError.notify);
1✔
21
        this.#port.removeListener('close', this.#notifyClose.notify);
1✔
22
        this.#notifyMessage[Symbol.dispose]();
1✔
23
        this.#notifyClose[Symbol.dispose]();
1✔
24
        this.#notifyMessageError[Symbol.dispose]();
1✔
25
    }
26

27
    /**
28
     * Event fired when a message is received.
29
     */
30
    get event(): NotifyEvent<unknown> {
31
        return this.#notifyMessage.event;
7✔
32
    }
33

34
    /**
35
     * Event fired when the port is closed.
36
     */
37
    get eventClose(): NotifyEvent<Event> {
NEW
38
        return this.#notifyClose.event;
×
39
    }
40

41
    /**
42
     * Event fired when a message error is received.
43
     */
44
    get eventMessageError(): NotifyEvent<Error> {
NEW
45
        return this.#notifyMessageError.event;
×
46
    }
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc