@urso/core 0.7.24 → 0.7.26

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.
@@ -582,6 +582,23 @@ class LibHelper {
582
582
 
583
583
  return results;
584
584
  }
585
+
586
+ /**
587
+ * apply params to string
588
+ * @param {String} string
589
+ * @param {Object} params
590
+ * @returns {String}
591
+ *
592
+ * @example interpolate('Bet ${bet} with Multi ${multi}', {bet:12,multi:13})
593
+ * returns 'Bet 12 with Multi 13'
594
+ */
595
+ interpolate(string, params) {
596
+ for (const [key, value] of Object.entries(params)) {
597
+ string = Urso.helper.stringReplace('${' + key + '}', value, string);
598
+ }
599
+
600
+ return string
601
+ }
585
602
  }
586
603
 
587
604
  module.exports = LibHelper;
@@ -38,9 +38,21 @@ class ModulesAssetsController {
38
38
  this.getInstance('Service').startLoad(assetsSpace, callback);
39
39
  }
40
40
 
41
+ /**
42
+ * load assets group bu name
43
+ * @param {String} name
44
+ * @param {Function} callback
45
+ */
41
46
  loadGroup(name, callback) {
42
47
  this.getInstance('Service').loadGroup(null, name, callback);
43
48
  }
49
+
50
+ /**
51
+ * system; check webP support
52
+ */
53
+ checkWebPSupport() {
54
+ this.getInstance('Service').checkWebPSupport();
55
+ }
44
56
  }
45
57
 
46
58
  module.exports = ModulesAssetsController;
@@ -11,6 +11,14 @@ class ModulesAssetsService {
11
11
  this.lazyLoadProcessStarted = false;
12
12
  };
13
13
 
14
+ /**
15
+ * system; check webP support
16
+ */
17
+ checkWebPSupport() {
18
+ if (Urso.device.webP)
19
+ Urso.addInstancesMode('webP');
20
+ }
21
+
14
22
  /**
15
23
  * get current quality
16
24
  * @returns {String}
@@ -11,7 +11,7 @@ class ModulesI18nController {
11
11
  */
12
12
  get(localeId, localeVariables = {}) {
13
13
  if (this.#vocabulary && this.#vocabulary[localeId]) {
14
- return this._interpolate(this.#vocabulary[localeId], localeVariables);
14
+ return Urso.helper.interpolate(this.#vocabulary[localeId], localeVariables);
15
15
  }
16
16
 
17
17
  return localeId;
@@ -66,14 +66,6 @@ class ModulesI18nController {
66
66
  const localeAsset = { type: Urso.types.assets.JSON, key: localeKey, path: pathToLocaleJson };
67
67
  Urso.assets.preload(localeAsset, () => this.setLocale(localeKey));
68
68
  }
69
-
70
- _interpolate(string, params) {
71
- for (const [key, value] of Object.entries(params)) {
72
- string = Urso.helper.stringReplace('${' + key + '}', value, string);
73
- }
74
-
75
- return string
76
- }
77
69
  }
78
70
 
79
71
  module.exports = ModulesI18nController;