Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP-3859 Make Events closable. Add EventsCollection base class. #73

Merged
merged 2 commits into from
Mar 28, 2017

Conversation

evanweible-wf
Copy link
Contributor

Issue

The Event class offered no public API for disposing/closing, which means that the underlying StreamController could not be closed.

Changes

  • Make Event closable via a close() method similar to StreamController.close(), except that it is protected by the DispatchKey.
  • Add an EventsCollection base class for colocating related Event instances that also makes disposal of said events easier via a manageEvent() method.
  • Bonus: updated the LifecycleModule class to implement the latest DisposableManagerV3 interface.
  • Bonus: updated and applied the license to all files

Testing

  • CI passes

Code Review

@Workiva/web-platform-pp
@Workiva/rich-app-platform-pp

@aviary-wf
Copy link

Raven

Number of Findings: 0

@evanweible-wf evanweible-wf changed the title Make Events closable. Add EventsCollection base class. WP-3859 Make Events closable. Add EventsCollection base class. Mar 28, 2017
@codecov-io
Copy link

codecov-io commented Mar 28, 2017

Codecov Report

Merging #73 into master will decrease coverage by 1.23%.
The diff coverage is 73.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
- Coverage   91.26%   90.03%   -1.24%     
==========================================
  Files           3        4       +1     
  Lines         309      321      +12     
==========================================
+ Hits          282      289       +7     
- Misses         27       32       +5
Impacted Files Coverage Δ
lib/src/serializable.dart 81.92% <ø> (ø) ⬆️
lib/src/lifecycle_module.dart 92.3% <0%> (-2.14%) ⬇️
lib/src/events_collection.dart 100% <100%> (ø)
lib/src/event.dart 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1001ebf...81178e2. Read the comment docs.

@todbachman-wf
Copy link
Member

+1

@bencampbell-wf
Copy link
Contributor

+1

@bencampbell-wf
Copy link
Contributor

bencampbell-wf commented Mar 28, 2017

+10

Things Tested

  • CI Passed

expect(event.close(incorrectKey), throwsArgumentError);
});

test('should now allow events to be dispatched after being closed',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now -> not

@trentgrover-wf
Copy link
Contributor

+1
address #nit someday

@trentgrover-wf
Copy link
Contributor

@jayudey-wf ready for you

@jayudey-wf
Copy link
Contributor

jayudey-wf commented Mar 28, 2017

QA +1

  • Testing instruction
  • Dev +1's
  • Dev/QA +10 with detail of what was tested
    • passing CI
    • verified that examples were still working as expected
  • Security review
  • Unit tests created/updated (additional coverage dependent on WP-3901 Complete test coverage for disposal update #74)
  • All unit tests pass
  • Rosie has run and reports properly the release the ticket will be included in
  • Dependency Scan Clean

Merging into master.

'Event dispatch expected the "${_key.name}" key but received the "${key.name}" key.');
'Event dispatch expected the "${_key.name}" key but received the '
'"${key.name}" key.');
}
_sink.add(payload);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StreamController also defines the add() method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, using the _sink and _stream getters was unnecessary now that I'm storing the controller

@dustinlessard-wf
Copy link
Contributor

As a followup, let's get the documentation updated : https://github.com/Workiva/w_module#events

@evanweible-wf
Copy link
Contributor Author

@dustinlessard-wf documentation updated, @jeroencranendonk-wf I addressed your comment, @trentgrover-wf I fixed the typo you caught

@jeroencranendonk-wf
Copy link

+1

1 similar comment
@dustinlessard-wf
Copy link
Contributor

+1

@bencampbell-wf
Copy link
Contributor

+10

Things Tested

  • CI Passed

@jayudey-wf
Copy link
Contributor

QA +1

  • Testing instruction
  • Dev +1's
  • Dev/QA +10 with detail of what was tested
    • passing CI
    • verified that examples were still working as expected
  • Security review
  • Unit tests created/updated (additional coverage dependent on WP-3901 Complete test coverage for disposal update #74)
  • All unit tests pass
  • Rosie has run and reports properly the release the ticket will be included in
  • Dependency Scan Clean

Merging into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants