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

feat(event-bus): implement simple eventbus class #43

Merged
merged 15 commits into from
Nov 13, 2023

Conversation

ilyamore88
Copy link
Member

@ilyamore88 ilyamore88 commented Nov 9, 2023

Task #22

Changelog

  • Add EventBus class
  • EventBus extends EventTarget methods
  • Add base events for blocks

ToDo

  • Add types for event objects
  • Connect the Document model to EventBus

Copy link

github-actions bot commented Nov 9, 2023

✅ Mutation testing passed

Report: https://dashboard.stryker-mutator.io/reports/github.com/editor-js/document-model/PR-43

Mutated files
src/utils/EventBus/EventBus.ts
src/utils/EventBus/events/BlockAddedEvent.ts
src/utils/EventBus/events/BlockModifiedEvent.ts
src/utils/EventBus/events/BlockRemovedEvent.ts
src/utils/EventBus/types/EventAction.ts
src/utils/EventBus/types/EventMap.ts
src/utils/EventBus/types/EventPayloadBase.ts
src/utils/EventBus/types/EventTarget.d.ts
src/utils/EventBus/types/EventType.ts
src/utils/EventBus/types/indexing.ts

Copy link

github-actions bot commented Nov 9, 2023

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 100% 453/453
🟢 Branches 99.21% 126/127
🟢 Functions 99.18% 121/122
🟢 Lines 100% 431/431

Test suite run success

311 tests passing in 18 suites.

Report generated by 🧪jest coverage report action from 033165d

@@ -0,0 +1,64 @@
import EventEmitter from 'eventemitter3';
Copy link
Contributor

Choose a reason for hiding this comment

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

why not to use native EventTarget?

Copy link
Contributor

Choose a reason for hiding this comment

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

70+ kb is too much for such a simple thing, I guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

Replaced with EventTarget

@ilyamore88 ilyamore88 requested a review from neSpecc November 11, 2023 11:16
/**
* The document model has been changed
*/
CHANGED = 'changed',
Copy link
Member

Choose a reason for hiding this comment

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

Please use PascalCase

@ilyamore88 ilyamore88 added this pull request to the merge queue Nov 13, 2023
Merged via the queue into main with commit 8111a5b Nov 13, 2023
5 checks passed
@ilyamore88 ilyamore88 deleted the feature/eventbus-class branch November 13, 2023 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants