Skip to content

Commit

Permalink
Watcher backends: remove unused event types
Browse files Browse the repository at this point in the history
Summary:
Currently watcher backends, which extend `EventEmitter`, emit two events for any file change:
 - One with event name `change`/`add`/`delete`
 - One with event name `all`, and `change`/`add`/`delete` in the payload.

We only ever listen to `all`. The former type is neither exercised nor tested. This removes the unused events.

Changelog: Internal

Reviewed By: hoxyq

Differential Revision: D67393484

fbshipit-source-id: 9ef824710be5f88f8e7d5462e37b076fe5aa0847
  • Loading branch information
robhogan authored and facebook-github-bot committed Dec 21, 2024
1 parent 11c062a commit c25f770
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/metro-file-map/src/watchers/FSEventsWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export default class FSEventsWatcher extends EventEmitter {
file: string,
metadata?: ChangeEventMetadata,
) {
this.emit(type, file, this.root, metadata);
this.emit(ALL_EVENT, type, file, this.root, metadata);
}

Expand Down
1 change: 0 additions & 1 deletion packages/metro-file-map/src/watchers/NodeWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ module.exports = class NodeWatcher extends EventEmitter {
file: string,
metadata: ?ChangeEventMetadata,
) {
this.emit(eventType, file, this.root, metadata);
this.emit(ALL_EVENT, eventType, file, this.root, metadata);
}

Expand Down
1 change: 0 additions & 1 deletion packages/metro-file-map/src/watchers/WatchmanWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ export default class WatchmanWatcher extends EventEmitter {
root: string,
changeMetadata?: ChangeEventMetadata,
) {
this.emit(eventType, filepath, root, changeMetadata);
this.emit(ALL_EVENT, eventType, filepath, root, changeMetadata);
}

Expand Down

0 comments on commit c25f770

Please sign in to comment.