@pernod-ricard-global-cms/jsutils 1.6.5 → 1.7.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/jsutils.js +23 -1
- package/package.json +28 -28
package/jsutils.js
CHANGED
|
@@ -564,6 +564,27 @@ export function checkIosVersion() {
|
|
|
564
564
|
return 0;
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
+
/**
|
|
568
|
+
* Function for adding a link tag with preconnect to the head of the document. Very useful if you need to add this dynamically.
|
|
569
|
+
* @param {string} domain The domain you wish to preconnect to.
|
|
570
|
+
* @returns {void} The preconnect will be appended to the head tag.
|
|
571
|
+
*/
|
|
572
|
+
export function appendPreconnect(domain) {
|
|
573
|
+
try {
|
|
574
|
+
if (!domain) {
|
|
575
|
+
console.log('The domain was missing or broken...');
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const link = document.createElement('link');
|
|
579
|
+
link.rel = 'preconnect';
|
|
580
|
+
link.href = domain;
|
|
581
|
+
document.head.appendChild(link);
|
|
582
|
+
return;
|
|
583
|
+
} catch (error) {
|
|
584
|
+
console.error(error);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
567
588
|
const api = {
|
|
568
589
|
copyToClipboard,
|
|
569
590
|
checkDevice,
|
|
@@ -587,6 +608,7 @@ const api = {
|
|
|
587
608
|
waitForLoad,
|
|
588
609
|
getElementStyles,
|
|
589
610
|
getPercent,
|
|
590
|
-
checkIosVersion
|
|
611
|
+
checkIosVersion,
|
|
612
|
+
appendPreconnect
|
|
591
613
|
};
|
|
592
614
|
export default api;
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
2
|
+
"name": "@pernod-ricard-global-cms/jsutils",
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"description": "Handy collection of Javascript utility functions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "jsutils.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "jasmine"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/Chivas-Brothers/jsUtils.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Chivas-Brothers/jsUtils/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/Chivas-Brothers/jsUtils#readme",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"gsap": "^3.7.1",
|
|
22
|
+
"jquery": "^3.6.0",
|
|
23
|
+
"prettier": "^2.5.1",
|
|
24
|
+
"swiper": "^6.8.3"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"jasmine": "^3.9.0",
|
|
28
|
+
"jsdoc": "^3.6.7"
|
|
29
|
+
}
|
|
30
30
|
}
|