@dpgradio/creative 5.1.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,15 +40,20 @@ The configuration will also be used by other components of this package (e.g. pr
40
40
  ```js
41
41
  import { configuration } from '@dpgradio/creative'
42
42
 
43
+ // Global config only
44
+ await configuration.retrieveConfigForDetectedStation()
45
+
46
+ // Global and app-specific config
43
47
  await configuration.retrieveConfigForDetectedStation(appId) // Default, by hostname or query parameter
44
48
 
45
49
  // Or, if you want to retrieve the config by hostnames only.
46
50
  await configuration.retrieveConfigByHostname(appId)
47
51
  // Or, if you want to retrieve the config for a specific station:
48
- await configuration.retrieveConfigByStation(appId, stationIdA, stationIdB, stationIdC)
52
+ await configuration.retrieveConfigByStation(stationId, appId)
49
53
 
50
54
  // By default the first station ID (stationIdA) is used as the current station of the configuration.
51
- // If you want to use a different station, you can do so by calling:
55
+ // If you want to use a different station, you can do so by calling setStation:
56
+ await configuration.retrieveConfigByStations([stationIdA, stationIdB, stationIdC], appId)
52
57
  configuration.setStation(stationIdC)
53
58
  ```
54
59
  You can change the station later on at any time without having to retrieve the config again.
@@ -1,13 +1,17 @@
1
1
  import configuration, { config } from '../src/config/config.js'
2
2
 
3
- const appId = 'greety'
3
+ global.window = { location: { hostname: 'qmusic.nl', search: '' } }
4
+
5
+ const appId = 'player'
4
6
  const stationIdA = 'qmusic_be'
5
7
  const stationIdB = 'qmusic_nl'
6
8
 
7
- await configuration.retrieveConfig(appId, stationIdA, stationIdB)
9
+ await configuration.retrieveConfigForDetectedStation()
10
+ console.log(config()) // global config
8
11
 
9
- console.log(config('app')) // greety config of qmusic_be
12
+ await configuration.retrieveConfigForDetectedStation(appId)
13
+ console.log(config('app')) // player config of qmusic_be
10
14
 
15
+ await configuration.retrieveConfigForStations([stationIdA, stationIdB], appId)
11
16
  configuration.setStation(stationIdB)
12
-
13
- console.log(config('app')) // greety config of qmusic_nl
17
+ console.log(config('app')) // player config of qmusic_nl