Skip to content

Commit

Permalink
Merge pull request #62 from MeetinaXD/feature/usesse-new
Browse files Browse the repository at this point in the history
feat(useSSE): basic useSSE() implement
  • Loading branch information
MeetinaXD committed Apr 17, 2024
2 parents d4f8cba + 79bd803 commit 29f9ff9
Show file tree
Hide file tree
Showing 24 changed files with 2,496 additions and 25 deletions.
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^14.0.0",
"@testing-library/vue": "^7.0.0",
"@types/eventsource": "^1.1.15",
"@types/jest": "^29.2.4",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
Expand All @@ -58,6 +59,7 @@
"eslint": "^8.29.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eventsource": "^2.0.2",
"husky": "^8.0.3",
"jest": "^29.2.2",
"jest-environment-jsdom": "^29.2.2",
Expand Down
26 changes: 22 additions & 4 deletions packages/scene-react/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
$,
$$,
_$,
_exp$,
_expBatch$,
onMounted$,
onUnmounted$,
upd$,
useFlag$,
useMemorizedCallback$,
useRequestRefState$,
watch$,
_$,
_exp$,
_expBatch$
watch$
} from '@/framework/react';
import { defineProperty, forEach, objectKeys } from '@/helper';
import { trueValue } from '@/helper/variables';
Expand All @@ -20,6 +20,7 @@ import useAutoRequest_unified from '@/hooks/useAutoRequest';
import useCaptcha_unified from '@/hooks/useCaptcha';
import useForm_unified from '@/hooks/useForm';
import useRetriableRequest_unified from '@/hooks/useRetriableRequest';
import useSSE_unified from '@/hooks/useSSE';
import { actionDelegationMiddleware as actionDelegationMiddleware_unified } from '@/middlewares/actionDelegation';

export const usePagination = (handler, config = {}) =>
Expand Down Expand Up @@ -93,3 +94,20 @@ forEach(objectKeys(useAutoRequest_unified), key => {
trueValue
);
});

// 导出useSSE
export const useSSE = (handler, config = {}) =>
useSSE_unified(
handler,
config,
$,
$$,
_$,
_exp$,
upd$,
watch$,
onMounted$,
onUnmounted$,
useFlag$,
useMemorizedCallback$
);

0 comments on commit 29f9ff9

Please sign in to comment.