@vdegenne/cmc 0.1.21 → 0.1.22

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
@@ -61,3 +61,31 @@ cmcManager.getCurrencyFromSymbol('btc').name // Bitcoin
61
61
 
62
62
  Pros: Data is fetched from CDN which will pull latest data possible. You don't have to build everytime data changes.
63
63
  Cons: More complex to integrate in your app, because now it's asynchronous and you have to make sure the data is fetched before feeding your views (use `cmcManager.ready`)
64
+
65
+ ## Where to fetch data from in dynamic mode?
66
+
67
+ By default it creates the url using the follow `UrlBuilderFunction` function:
68
+
69
+ ```ts
70
+ async function (getLastVersion) {
71
+ return `https://cdn.jsdelivr.net/npm/@vdegenne/cmc@${await getLastVersion()}/mini.json`;
72
+ }
73
+ ```
74
+
75
+ You can also use your own builder function:
76
+
77
+ ```ts
78
+ new CMCManager({
79
+ async remoteUrl(getLastVersion) {
80
+ return `https://unpkg.com/@vdegenne/cmc@${await getLastVersion()}/data/all.json`
81
+ },
82
+ })
83
+ ```
84
+
85
+ Or just a simple string:
86
+
87
+ ```ts
88
+ new CMCManager({
89
+ remoteUrl: 'https://unpkg.com/@vdegenne/cmc@0.1.17/data/mini.json',
90
+ })
91
+ ```