events: simplify event target agnostic logic in on and once
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
This simplifies logic related to EventTarget handling and shortens the code.
/cc @nodejs/events @jasnell