@webalternatif/js-core 1.6.6 → 1.6.7

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/dist/cjs/utils.js CHANGED
@@ -247,6 +247,13 @@ var debounce = exports.debounce = function debounce(func, wait) {
247
247
  };
248
248
  var getScrollbarWidth = exports.getScrollbarWidth = function () {
249
249
  var scrollbarWidth = null;
250
+
251
+ /**
252
+ * Returns the browser scrollbar width in pixels.
253
+ * The value is computed once and then cached.
254
+ *
255
+ * @returns {number} - The scrollbar width in pixels.
256
+ */
250
257
  return function () {
251
258
  if (scrollbarWidth === null) {
252
259
  var outer = document.createElement('div');
package/dist/esm/utils.js CHANGED
@@ -243,6 +243,13 @@ export var debounce = function debounce(func, wait) {
243
243
  };
244
244
  export var getScrollbarWidth = function () {
245
245
  var scrollbarWidth = null;
246
+
247
+ /**
248
+ * Returns the browser scrollbar width in pixels.
249
+ * The value is computed once and then cached.
250
+ *
251
+ * @returns {number} - The scrollbar width in pixels.
252
+ */
246
253
  return function () {
247
254
  if (scrollbarWidth === null) {
248
255
  var outer = document.createElement('div');
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "name": "Ludovic Tarit",
13
13
  "email": "ludovic.tarit@webalternatif.com"
14
14
  },
15
- "version": "1.6.6",
15
+ "version": "1.6.7",
16
16
  "type": "module",
17
17
  "types": "types/index.d.ts",
18
18
  "main": "dist/cjs/index.js",
package/src/utils.js CHANGED
@@ -244,6 +244,12 @@ export const debounce = function (func, wait, immediate = false, context = null)
244
244
  export const getScrollbarWidth = (() => {
245
245
  let scrollbarWidth = null
246
246
 
247
+ /**
248
+ * Returns the browser scrollbar width in pixels.
249
+ * The value is computed once and then cached.
250
+ *
251
+ * @returns {number} - The scrollbar width in pixels.
252
+ */
247
253
  return function () {
248
254
  if (scrollbarWidth === null) {
249
255
  const outer = document.createElement('div')
package/types/index.d.ts CHANGED
@@ -19,7 +19,7 @@ declare const webf: {
19
19
  strParseFloat: (val: any) => number;
20
20
  throttle: (func: Function, wait: number, leading?: boolean, trailing?: boolean, context?: any) => Function;
21
21
  debounce: (func: Function, wait: number, immediate?: boolean, context?: any) => Function;
22
- getScrollbarWidth: () => any;
22
+ getScrollbarWidth: () => number;
23
23
  round: (val: number, precision?: number) => number;
24
24
  floorTo: (val: number, precision: number) => number;
25
25
  plancher: (val: number, precision: number) => number;
package/types/utils.d.ts CHANGED
@@ -5,4 +5,4 @@ export function flatten(o: Object | any[]): any[];
5
5
  export function strParseFloat(val: any): number;
6
6
  export function throttle(func: Function, wait: number, leading?: boolean, trailing?: boolean, context?: any): Function;
7
7
  export function debounce(func: Function, wait: number, immediate?: boolean, context?: any): Function;
8
- export function getScrollbarWidth(): any;
8
+ export function getScrollbarWidth(): number;