New answers tagged

0

Copy-Pasted code As you disclosed, the code has a lot of code that is copied and pasted. This goes against the Don't Repeat Yourself principle . I was also told about the risk of using so many equal headers, as I use the <script src="https://d3js.org/d3.v4.js"></script> four times but how I need it for the 4 scripts, I don't know how I ...


1

Events or messages? Is this a messaging system or an event system. As I see it, it is a messaging system. Assuming this is for the browser you may prefer the provided events.Event API which will use the event stack. NOTE check comparability before using. Review A general style code review. Code style is subjective and thus these points are just suggestions ...


2

I couldn't find any obvious bugs, so that's good! For improvements, I have a few comments. It's mostly about readability, and of course it's just my subjective experience when I read the code: If handler is not a function, you should throw an error. It's obviously a mistake. When extending base classes you should not rewrite the extended method signatures. ...


3

What you've done is conceptually wrong Events are there to allow other objects to be notified and react when something happens. That said, your solution works and does what you want, at least at a first short glance, but it's misusing the event system for something it should not be doing. Events are there to allow objects with different responsibilities to ...


1

Events should report when something changed. edit as pointed out events can be before or after. I'm just used to mainly dealing with after but events can happen before and some events that happen before even allow for the process to be cancelled. But the main point is events are fired for something happening and events don't make the change happen. In your ...


Top 50 recent answers are included