hopscotch
hopscotch copied to clipboard
Configs! step vs tour vs global vs defaults
this sounds like a mess, we should have a consistent interface for setting hopscotch configs at each level
+1
As part of breaking things apart in #72, I could see us creating a config class that acts as an accessor for other components to read from or set to. Probably similar to HopscotchBubble
, each callout or Hopscotch
would own its own config
class. Or maybe HopscotchBubble
creates its own config
instance when it's created.
Dunno if there are any utils that are relying on global configs, though. We'll have to explore this more and see what relies on configs and where their configs are coming from. In general, though, does the above sound like it's going in the right direction?
I've created a simple version of the config on gh72 branch
https://github.com/linkedin/hopscotch/blob/gh72/src/es/modules/config.js
The idea with this approach is that config can inherit from another config. So we will have a hierarchy of configs defaultConfig, globalConfig (hopscotch.configure), tourConfig (tour level options) and calloutConfig(standalone callout options, or specific step options. Inherits from globalConfig if it's a standalone callout).
We still need unit tests for this module, but it's 70% there :)