2 ms·
Having a single function as an interface actually complicates things. I'd recommend separating it into functions that each does one thing only. For example: -
by lioeters 7y ago
Having a single function as an interface actually complicates things. I'd recommend separating it into functions that each does one thing only.
For example:
- Register template
- Register worker
- Create store
- Create element
- Add event handler
Give them explicit names and function signatures (number and type of arguments).
An abstraction is great until it becomes too far removed from the actual operations that it performs. Among programmers, this is called "magic", as a term of criticism. Avoid too much magic: show us the internal workings, and give users the power to handle the things (data and algorithms) directly and concretely.