@pernod-ricard-global-cms/jsutils 1.7.0 → 1.7.1
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 +8 -0
- package/package.json +1 -1
package/jsutils.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* eslint-disable consistent-return */
|
|
2
2
|
/* eslint-disable no-console */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Function for check whether the code is running within the Wordpress admin page. Checks for wp-admin class.
|
|
6
|
+
* @returns {Boolean}
|
|
7
|
+
*/
|
|
8
|
+
export function isWpAdmin() {
|
|
9
|
+
return document.body.classList.contains('wp-admin') ? true : false;
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
/**
|
|
5
13
|
* This function accepts an html element and returns the position of that element on the page.
|
|
6
14
|
*
|