Hacker News new | ask | show | jobs
by tboyd47 3068 days ago
Biggest thing is not exposing any internals to customization, but just coding a widget, wrapping it in a closure and calling it a day.

It's such a pain to have to fork a UI library or include the source code into my build pipeline just to make a small change.

One of the easiest and most helpful techniques for library authors to do this in JS is to make your public methods optionally accept functions that resolve to whatever data type you are expecting.

  if(typeof arg == "function") { arg = arg(); }
In ancient times, they called this the "open/closed" principle.