@aliexme/react-utils 0.0.1 → 0.1.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/hooks/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export * from './useValueRef';
2
2
  export * from './usePrevious';
3
+ export * from './useDidMount';
4
+ export * from './useWillUnmount';
package/hooks/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './useValueRef';
2
2
  export * from './usePrevious';
3
+ export * from './useDidMount';
4
+ export * from './useWillUnmount';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { type EffectCallback } from 'react';
2
+ export declare const useDidMount: (effect: EffectCallback) => void;
@@ -0,0 +1,5 @@
1
+ import { useEffect } from 'react';
2
+ export const useDidMount = (effect) => {
3
+ useEffect(effect, []);
4
+ };
5
+ //# sourceMappingURL=useDidMount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDidMount.js","sourceRoot":"","sources":["../src/hooks/useDidMount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAsB,EAAE,EAAE;IACpD,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACvB,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const useWillUnmount: (destructor: () => void) => void;
@@ -0,0 +1,7 @@
1
+ import { useDidMount } from './useDidMount';
2
+ export const useWillUnmount = (destructor) => {
3
+ useDidMount(() => {
4
+ return destructor;
5
+ });
6
+ };
7
+ //# sourceMappingURL=useWillUnmount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWillUnmount.js","sourceRoot":"","sources":["../src/hooks/useWillUnmount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAsB,EAAE,EAAE;IACvD,WAAW,CAAC,GAAG,EAAE;QACf,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@aliexme/react-utils",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "React utilites",
5
5
  "private": false,
6
6
  "author": "Alexander Smirnov <al.smirnov996@gmail.com>",
7
- "homepage": "https://github.com/aliexme/js-utils",
7
+ "homepage": "https://github.com/aliexme/react-utils",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/aliexme/js-utils"
10
+ "url": "https://github.com/aliexme/react-utils"
11
11
  },
12
12
  "license": "MIT",
13
13
  "main": "index.js",