Open ATorrise opened 1 month ago
Attention: Patch coverage is 86.66667%
with 30 lines
in your changes missing coverage. Please review.
Project coverage is 91.05%. Comparing base (
abadee5
) to head (7403112
). Report is 2 commits behind head on next.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Had to add an appendFileSync
mock to Zowe Explorer in order to test code that calls the event emitter. Hopefully after this PR is merged that won't be necessary anymore 😋 See https://github.com/zowe/zowe-explorer-vscode/pull/2932/commits/1efd4f71a0cfa1e4acb2db38211bd27532bb630c
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
86.1% Coverage on New Code
0.0% Duplication on New Code
Overview
The
EventOperator
class is a singleton controller for managingEventProcessor
instances. It organizes event management for applications by mapping each application's name to an event processor, which manages and fires callbacks provided by the subscriber to a given application-specific event.Example Use Case
Imagine you have a Notepad application that wants to subscribe to events from a Calculator application to display the numbers typed in the Calculator:
EventProcessor
instance with watch permissions for the Calculator from theEventOperator
.Design Pattern
Instances of
EventProcessor
are stored within a static map insideEventOperator
, keyed by application names. This prevents cross-application event collisions, maintains a clean separation of events, and allows multiple applications to subscribe to the same application-specific events efficiently.Functionality
EventOperator
manages singleton instances ofEventProcessor
for different applications. Retrieves existing instances or creates new ones as needed.EventProcessor
manages its own subscriptions, handling the addition, emission, and removal of events. It uses a map where event names are keys, and values areEvent
objects that hold detailed event information and subscriptions.eventTimes
map to meet specific timing requirements forFsWatcher
.Code Examples
Event Types Explained
Within our system, events are categorized into four main types:
~/.zowe/.events/Zowe/$userEventName
$ZOWE_CLI_HOME/.events/Zowe/$sharedEventName
~/.zowe/.events/$appName/$customSharedEventName
$ZOWE_CLI_HOME/.events/$appName/$customSharedEventName
How to Test
Operate the sample VSCE without error:
Review Checklist I certify that I have: