@aiszlab/relax 1.2.45 → 1.2.47

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.
@@ -3,4 +3,4 @@
3
3
  * devicePixelRatio
4
4
  * in different device, ratio
5
5
  */
6
- export declare const useDevicePixelRatio: () => number;
6
+ export declare const useDevicePixelRatio: () => number | undefined;
@@ -1,5 +1,6 @@
1
1
  import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
2
2
  import { useState } from 'react';
3
+ import { isDomUsable } from '../is/is-dom-usable.js';
3
4
 
4
5
  /**
5
6
  * @description
@@ -7,7 +8,9 @@ import { useState } from 'react';
7
8
  * in different device, ratio
8
9
  */
9
10
  var useDevicePixelRatio = function useDevicePixelRatio() {
10
- var _useState = useState(window.devicePixelRatio),
11
+ var _useState = useState(function () {
12
+ if (!isDomUsable()) return 1;
13
+ }),
11
14
  _useState2 = _slicedToArray(_useState, 1),
12
15
  devicePixelRatio = _useState2[0];
13
16
  return devicePixelRatio;
@@ -17,6 +17,7 @@ var useRaf = function useRaf(_callback) {
17
17
  isTimed.current = true;
18
18
  timely && callback();
19
19
  timed.current = requestAnimationFrame(function () {
20
+ isTimed.current = false;
20
21
  !timely && callback();
21
22
  });
22
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "react utils collection",
5
5
  "type": "module",
6
6
  "exports": {