Looking at the source for the examples, I really can't see how that's practical to write. It may be fast but damn is that code gnarly.
For example, https://api.anychart.com/7.11.1/anychart.palettes.DistinctCo... - why would you want to attach listeners to palette colors? There might be a great reason, or those methods might just have been inherited from the base class, but the documentation is no to your understanding help whatsoever. The example is for the base class rather than the palette object.
This is actually a good example of bad documentation.