@abtnode/ux 1.16.30-beta-b7f31b10 → 1.16.30-beta-2876881d

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.
@@ -1,40 +0,0 @@
1
- /* eslint-disable import/prefer-default-export */
2
- import { useAsyncEffect } from 'ahooks';
3
- import { useState } from 'react';
4
- import { useBlockletContext } from '../contexts/blocklet';
5
- import { useNodeContext } from '../contexts/node';
6
-
7
- /**
8
- * @description
9
- * @export
10
- * @param {*} [{ deps }={ deps: [] }]
11
- * @return {import('@abtnode/client').AutoBackup | null}
12
- */
13
- export function useAutoBackup({
14
- deps
15
- } = {
16
- deps: []
17
- }) {
18
- /** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
19
- const {
20
- blocklet
21
- } = useBlockletContext();
22
- /** @type {{api: import('@abtnode/client')}} */
23
- const {
24
- api
25
- } = useNodeContext();
26
- const [autoBackup, setAutoBackup] = useState(null);
27
- useAsyncEffect(async () => {
28
- if (blocklet?.meta?.did) {
29
- const {
30
- autoBackup: data
31
- } = await api.getAutoBackup({
32
- input: {
33
- did: blocklet.meta.did
34
- }
35
- });
36
- setAutoBackup(data);
37
- }
38
- }, [blocklet?.meta?.did].concat(deps));
39
- return autoBackup;
40
- }
@@ -1,33 +0,0 @@
1
- /* eslint-disable import/prefer-default-export */
2
- import { useAsyncEffect } from 'ahooks';
3
- import { useState } from 'react';
4
- import { useBlockletContext } from '../contexts/blocklet';
5
- import { useNodeContext } from '../contexts/node';
6
- export function useAutoCheckUpdate({
7
- deps
8
- } = {
9
- deps: []
10
- }) {
11
- /** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
12
- const {
13
- blocklet
14
- } = useBlockletContext();
15
- /** @type {{api: import('@abtnode/client')}} */
16
- const {
17
- api
18
- } = useNodeContext();
19
- const [autoCheckUpdate, setAutoCheckUpdate] = useState(null);
20
- useAsyncEffect(async () => {
21
- if (blocklet?.meta?.did) {
22
- const {
23
- autoCheckUpdate: data
24
- } = await api.getAutoCheckUpdate({
25
- input: {
26
- did: blocklet.meta.did
27
- }
28
- });
29
- setAutoCheckUpdate(data);
30
- }
31
- }, [blocklet?.meta?.did].concat(deps));
32
- return autoCheckUpdate;
33
- }