mint-metrics / mojito-js-delivery

🧪 Source-controlled JS split testing framework for building and launching A/B tests.
https://mojito.mx/docs/js-delivery-intro
Other
16 stars 30 forks source link

Make options configurable on Mojito library init #67

Open kingo55 opened 4 years ago

kingo55 commented 4 years ago

Currently default "Options" are intermingled with the library code which makes it awkward for users to override defaults.

https://github.com/kingo55/mojito-js-delivery/blob/9f313bd1ba59f1f8dcb80cc4df41b6b02b08f28c/lib/mojito.js#L4-L14

Might there be a way we could initialise Mojito explicitly? e.g.:

// lib code
...

Mojito.init({
  debug: false,
  cookieDuration: 7,
  ...
});

Or is the current approach better? I.e. sane defaults hardcoded and users override specific options like:

Mojito.options.excluded = true;
allmywant commented 4 years ago

@kingo55 I think Mojito.init({ options }) is better.