Review main Merged

63336[FEATURE] Add JavaScript event handling API

Andreas Kienast CR +2 V +2 Hard +633 −246 updated 02/22/20, 16:43

Commit message

This patch adds API for event handling in JavaScript. The goal is to have
an easy-to-use event handling and delegation by shipping several event
strategies.

Debounce:
Debounces an event listener that is executed after the event happened,
either at the start or at the end. A debounced event listener is not
executed again until a certain amount of time has passed without it being
called.

RequestAnimationFrame:
Traps an event listener into the browser's native rAF API.

Throttle:
Throttles the event listener to be called only after a defined time
during the event's execution over time.

Review

  • Code review CR +2 Done
    • Susi Moog +2
    • Markus Klein +1
  • Verified V +2 Done
    • Susi Moog +2
    • Markus Klein +1
    • TYPO3com +1 CI

Issues 1

Files 14

Review log 1822

  1. Andreas Kienast uploaded patch set 1 02/20/20, 19:25

  2. TYPO3com voted on patch set 1 V +1 02/20/20, 20:03 Completed build in 30m 29s on Thu, 20 Feb, 08:03 PM Test Summary: 71464 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-360

  3. Andreas Kienast uploaded patch set 2 02/20/20, 21:24

  4. Benni Mack commented on patch set 2 02/20/20, 21:40

    AbstractEvent.ts:16 Unresolved

    how about we make this an interface, and move the AbstractEvent part to the regularEvent? So people can work against an interface.
  5. Andreas Kienast uploaded patch set 3 02/20/20, 22:11

  6. TYPO3com voted on patch set 3 V +1 02/20/20, 23:43 Completed build in 1h 04m 27s on Thu, 20 Feb, 11:43 PM Test Summary: 71464 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-372

  7. Andreas Kienast uploaded patch set 4 02/21/20, 16:31

  8. Markus Klein commented on patch set 4 02/21/20, 16:57

    RegularEvent.ts:44

    If I register the same event with the same callback multiple times, this will not achieve the desired functionality. Did you check the jquery source how the uniquely identify the registered handlers?
  9. Markus Klein commented on patch set 4 02/21/20, 16:58

    General question: couldn't we use the rxjs library for this? It is capable of all this already, afaik
  10. Markus Klein commented on patch set 4 02/21/20, 16:58

    Sorry, forgot the link https://rxjs.dev/guide/overview
  11. Andreas Kienast commented on patch set 4 02/21/20, 17:05

    > Patch Set 4: > > General question: couldn't we use the rxjs library for this? > It is capable of all this already, afaik We might use that library instead, but I don't have any knowledge in that one. Somebody else has to step in then.

    RegularEvent.ts:44 Reply

    No, I didn't. But why would one do that?
  12. TYPO3com voted on patch set 4 V +1 02/21/20, 17:49 Completed build in 1h 05m 28s on Fri, 21 Feb, 05:49 PM Test Summary: 71464 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-419

  13. Markus Klein commented on patch set 4 02/21/20, 19:08

    > Patch Set 4: > > (1 comment) > > > Patch Set 4: > > > > General question: couldn't we use the rxjs library for this? > > It is capable of all this already, afaik > > We might use that library instead, but I don't have any knowledge in that one. Somebody else has to step in then. I'll check if it would be suitable for us, or if it is overkill. This lib is a basis used in Angular for instance. It's all about observables. (which are basically better than Promises)

    RegularEvent.ts:44 Reply Unresolved

    Well, this should be a generic lib, so it should cover those edge-cases. I don't have a concrete example, where this might be the case, but I just wanted to point out that the potential issue exists.
  14. Markus Klein commented on patch set 4 02/21/20, 19:12

    > Patch Set 4: > > (1 comment) > > > Patch Set 4: > > > > (1 comment) > > > > > Patch Set 4: > > > > > > General question: couldn't we use the rxjs library for this? > > > It is capable of all this already, afaik > > > > We might use that library instead, but I don't have any knowledge in that one. Somebody else has to step in then. > > I'll check if it would be suitable for us, or if it is overkill. This lib is a basis used in Angular for instance. It's all about observables. (which are basically better than Promises) Okay, it would maybe be a bit too much to throw that one in for now. We could take the lib as a possible goal for v11 and replace Promises bit by bit with Obserables.
  15. Markus Klein commented on patch set 4 02/21/20, 19:17

    InlineControlContainer.ts:237

    why not a RegularEvent?
  16. Andreas Kienast commented on patch set 4 02/21/20, 19:27

    InlineControlContainer.ts:237 Reply Unresolved

    I missed that one, I'll fix that ASAP
  17. Andreas Kienast uploaded patch set 5 02/21/20, 20:45

  18. Markus Klein voted on patch set 5 CR +1 02/21/20, 22:07

  19. Markus Klein voted on patch set 5 V +1 02/21/20, 22:11

  20. TYPO3com voted on patch set 5 V +1 02/21/20, 22:37 Completed build in 1h 02m 18s on Fri, 21 Feb, 10:37 PM Test Summary: 71474 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-437

  21. Susi Moog voted on patch set 5 V +2 CR +2 02/22/20, 16:43

  22. Susi Moog merged patch set 6 02/22/20, 16:43