@reactuses/core 5.0.22 → 5.0.23-beta.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/dist/index.cjs +245 -48
- package/dist/index.d.cts +159 -1
- package/dist/index.d.mts +159 -1
- package/dist/index.d.ts +159 -1
- package/dist/index.mjs +245 -49
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ import Cookies from 'js-cookie';
|
|
|
4
4
|
import { DebounceSettings, ThrottleSettings, DebouncedFunc as DebouncedFunc$1 } from 'lodash-es';
|
|
5
5
|
import * as lodash from 'lodash';
|
|
6
6
|
import { DebounceSettings as DebounceSettings$1, DebouncedFunc, ThrottleSettings as ThrottleSettings$1 } from 'lodash';
|
|
7
|
+
import { FetchEventSourceInit } from '@microsoft/fetch-event-source';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @title useActiveElement
|
|
@@ -3031,6 +3032,163 @@ interface UseElementByPointReturn<M extends boolean> extends Pausable$1 {
|
|
|
3031
3032
|
|
|
3032
3033
|
declare const useElementByPoint: UseElementByPoint;
|
|
3033
3034
|
|
|
3035
|
+
/**
|
|
3036
|
+
* @title UseFetchEventSourceStatus
|
|
3037
|
+
* @description Connection status of EventSource
|
|
3038
|
+
*/
|
|
3039
|
+
type UseFetchEventSourceStatus = 'CONNECTING' | 'CONNECTED' | 'DISCONNECTED';
|
|
3040
|
+
/**
|
|
3041
|
+
* @title UseFetchEventSourceAutoReconnectOptions
|
|
3042
|
+
*/
|
|
3043
|
+
interface UseFetchEventSourceAutoReconnectOptions {
|
|
3044
|
+
/**
|
|
3045
|
+
* @en The number of retries, if it is a function, it will be called to determine whether to retry
|
|
3046
|
+
* @zh 重试次数,如果是函数,会调用来判断是否重试
|
|
3047
|
+
*/
|
|
3048
|
+
retries?: number | (() => boolean);
|
|
3049
|
+
/**
|
|
3050
|
+
* @en The delay time before reconnecting (ms)
|
|
3051
|
+
* @zh 重连前的延迟时间(毫秒)
|
|
3052
|
+
*/
|
|
3053
|
+
delay?: number;
|
|
3054
|
+
/**
|
|
3055
|
+
* @en Callback when reconnection fails
|
|
3056
|
+
* @zh 重连失败时的回调
|
|
3057
|
+
*/
|
|
3058
|
+
onFailed?: () => void;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* @title UseFetchEventSourceOptions
|
|
3062
|
+
*/
|
|
3063
|
+
interface UseFetchEventSourceOptions extends Omit<FetchEventSourceInit, 'signal'> {
|
|
3064
|
+
/**
|
|
3065
|
+
* @en HTTP method for the request
|
|
3066
|
+
* @zh HTTP 请求方法
|
|
3067
|
+
*/
|
|
3068
|
+
method?: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* @en Request headers
|
|
3071
|
+
* @zh 请求头
|
|
3072
|
+
*/
|
|
3073
|
+
headers?: Record<string, string>;
|
|
3074
|
+
/**
|
|
3075
|
+
* @en Request body for POST requests
|
|
3076
|
+
* @zh POST 请求的请求体
|
|
3077
|
+
*/
|
|
3078
|
+
body?: any;
|
|
3079
|
+
/**
|
|
3080
|
+
* @en Use credentials
|
|
3081
|
+
* @zh 使用凭证
|
|
3082
|
+
*/
|
|
3083
|
+
withCredentials?: boolean;
|
|
3084
|
+
/**
|
|
3085
|
+
* @en Immediately open the connection, enabled by default
|
|
3086
|
+
* @zh 立即打开连接,默认打开
|
|
3087
|
+
*/
|
|
3088
|
+
immediate?: boolean;
|
|
3089
|
+
/**
|
|
3090
|
+
* @en Automatically reconnect when the connection is disconnected
|
|
3091
|
+
* @zh 连接断开时自动重连
|
|
3092
|
+
*/
|
|
3093
|
+
autoReconnect?: UseFetchEventSourceAutoReconnectOptions;
|
|
3094
|
+
/**
|
|
3095
|
+
* @en Callback when connection opens
|
|
3096
|
+
* @zh 连接打开时的回调
|
|
3097
|
+
*/
|
|
3098
|
+
onOpen?: () => void;
|
|
3099
|
+
/**
|
|
3100
|
+
* @en Callback when message received
|
|
3101
|
+
* @zh 接收到消息时的回调
|
|
3102
|
+
*/
|
|
3103
|
+
onMessage?: (event: UseFetchEventSourceMessage) => void;
|
|
3104
|
+
/**
|
|
3105
|
+
* @en Callback when error occurs, return number to retry after specified milliseconds
|
|
3106
|
+
* @zh 发生错误时的回调,返回数字表示多少毫秒后重试
|
|
3107
|
+
*/
|
|
3108
|
+
onError?: (error: Error) => number | void | null | undefined;
|
|
3109
|
+
/**
|
|
3110
|
+
* @en Callback when connection closes
|
|
3111
|
+
* @zh 连接关闭时的回调
|
|
3112
|
+
*/
|
|
3113
|
+
onClose?: () => void;
|
|
3114
|
+
}
|
|
3115
|
+
/**
|
|
3116
|
+
* @title UseFetchEventSourceMessage
|
|
3117
|
+
*/
|
|
3118
|
+
interface UseFetchEventSourceMessage {
|
|
3119
|
+
/**
|
|
3120
|
+
* @en The event ID
|
|
3121
|
+
* @zh 事件 ID
|
|
3122
|
+
*/
|
|
3123
|
+
id: string | null;
|
|
3124
|
+
/**
|
|
3125
|
+
* @en The event type
|
|
3126
|
+
* @zh 事件类型
|
|
3127
|
+
*/
|
|
3128
|
+
event: string | null;
|
|
3129
|
+
/**
|
|
3130
|
+
* @en The event data
|
|
3131
|
+
* @zh 事件数据
|
|
3132
|
+
*/
|
|
3133
|
+
data: string;
|
|
3134
|
+
}
|
|
3135
|
+
/**
|
|
3136
|
+
* @title UseFetchEventSourceReturn
|
|
3137
|
+
*/
|
|
3138
|
+
interface UseFetchEventSourceReturn {
|
|
3139
|
+
/**
|
|
3140
|
+
* @en The data received
|
|
3141
|
+
* @zh 接收到的数据
|
|
3142
|
+
*/
|
|
3143
|
+
data: string | null;
|
|
3144
|
+
/**
|
|
3145
|
+
* @en The error occurred
|
|
3146
|
+
* @zh 发生的错误
|
|
3147
|
+
*/
|
|
3148
|
+
error: Error | null;
|
|
3149
|
+
/**
|
|
3150
|
+
* @en The status of the connection
|
|
3151
|
+
* @zh 连接的状态
|
|
3152
|
+
*/
|
|
3153
|
+
status: UseFetchEventSourceStatus;
|
|
3154
|
+
/**
|
|
3155
|
+
* @en The last event ID
|
|
3156
|
+
* @zh 最后的事件 ID
|
|
3157
|
+
*/
|
|
3158
|
+
lastEventId: string | null;
|
|
3159
|
+
/**
|
|
3160
|
+
* @en The event name
|
|
3161
|
+
* @zh 事件名
|
|
3162
|
+
*/
|
|
3163
|
+
event: string | null;
|
|
3164
|
+
/**
|
|
3165
|
+
* @en Close the connection
|
|
3166
|
+
* @zh 关闭连接
|
|
3167
|
+
*/
|
|
3168
|
+
close: () => void;
|
|
3169
|
+
/**
|
|
3170
|
+
* @en Open the connection
|
|
3171
|
+
* @zh 打开连接
|
|
3172
|
+
*/
|
|
3173
|
+
open: () => void;
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* @title UseFetchEventSource
|
|
3177
|
+
*/
|
|
3178
|
+
type UseFetchEventSource = (
|
|
3179
|
+
/**
|
|
3180
|
+
* @en The URL of the server-sent event
|
|
3181
|
+
* @zh 服务器发送事件的 URL
|
|
3182
|
+
*/
|
|
3183
|
+
url: string | URL,
|
|
3184
|
+
/**
|
|
3185
|
+
* @en EventSource options
|
|
3186
|
+
* @zh EventSource 选项
|
|
3187
|
+
*/
|
|
3188
|
+
options?: UseFetchEventSourceOptions) => UseFetchEventSourceReturn;
|
|
3189
|
+
|
|
3190
|
+
declare const useFetchEventSource: UseFetchEventSource;
|
|
3191
|
+
|
|
3034
3192
|
/**
|
|
3035
3193
|
* @title useDocumentVisiblity
|
|
3036
3194
|
* @returns_en document visibility
|
|
@@ -3438,4 +3596,4 @@ type Use = <T>(
|
|
|
3438
3596
|
*/
|
|
3439
3597
|
usable: Usable<T>) => T;
|
|
3440
3598
|
|
|
3441
|
-
export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePreferredLanguages, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|
|
3599
|
+
export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFetchEventSource, type UseFetchEventSourceAutoReconnectOptions, type UseFetchEventSourceMessage, type UseFetchEventSourceOptions, type UseFetchEventSourceReturn, type UseFetchEventSourceStatus, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePreferredLanguages, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import Cookies from 'js-cookie';
|
|
|
4
4
|
import { DebounceSettings, ThrottleSettings, DebouncedFunc as DebouncedFunc$1 } from 'lodash-es';
|
|
5
5
|
import * as lodash from 'lodash';
|
|
6
6
|
import { DebounceSettings as DebounceSettings$1, DebouncedFunc, ThrottleSettings as ThrottleSettings$1 } from 'lodash';
|
|
7
|
+
import { FetchEventSourceInit } from '@microsoft/fetch-event-source';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @title useActiveElement
|
|
@@ -3031,6 +3032,163 @@ interface UseElementByPointReturn<M extends boolean> extends Pausable$1 {
|
|
|
3031
3032
|
|
|
3032
3033
|
declare const useElementByPoint: UseElementByPoint;
|
|
3033
3034
|
|
|
3035
|
+
/**
|
|
3036
|
+
* @title UseFetchEventSourceStatus
|
|
3037
|
+
* @description Connection status of EventSource
|
|
3038
|
+
*/
|
|
3039
|
+
type UseFetchEventSourceStatus = 'CONNECTING' | 'CONNECTED' | 'DISCONNECTED';
|
|
3040
|
+
/**
|
|
3041
|
+
* @title UseFetchEventSourceAutoReconnectOptions
|
|
3042
|
+
*/
|
|
3043
|
+
interface UseFetchEventSourceAutoReconnectOptions {
|
|
3044
|
+
/**
|
|
3045
|
+
* @en The number of retries, if it is a function, it will be called to determine whether to retry
|
|
3046
|
+
* @zh 重试次数,如果是函数,会调用来判断是否重试
|
|
3047
|
+
*/
|
|
3048
|
+
retries?: number | (() => boolean);
|
|
3049
|
+
/**
|
|
3050
|
+
* @en The delay time before reconnecting (ms)
|
|
3051
|
+
* @zh 重连前的延迟时间(毫秒)
|
|
3052
|
+
*/
|
|
3053
|
+
delay?: number;
|
|
3054
|
+
/**
|
|
3055
|
+
* @en Callback when reconnection fails
|
|
3056
|
+
* @zh 重连失败时的回调
|
|
3057
|
+
*/
|
|
3058
|
+
onFailed?: () => void;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* @title UseFetchEventSourceOptions
|
|
3062
|
+
*/
|
|
3063
|
+
interface UseFetchEventSourceOptions extends Omit<FetchEventSourceInit, 'signal'> {
|
|
3064
|
+
/**
|
|
3065
|
+
* @en HTTP method for the request
|
|
3066
|
+
* @zh HTTP 请求方法
|
|
3067
|
+
*/
|
|
3068
|
+
method?: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* @en Request headers
|
|
3071
|
+
* @zh 请求头
|
|
3072
|
+
*/
|
|
3073
|
+
headers?: Record<string, string>;
|
|
3074
|
+
/**
|
|
3075
|
+
* @en Request body for POST requests
|
|
3076
|
+
* @zh POST 请求的请求体
|
|
3077
|
+
*/
|
|
3078
|
+
body?: any;
|
|
3079
|
+
/**
|
|
3080
|
+
* @en Use credentials
|
|
3081
|
+
* @zh 使用凭证
|
|
3082
|
+
*/
|
|
3083
|
+
withCredentials?: boolean;
|
|
3084
|
+
/**
|
|
3085
|
+
* @en Immediately open the connection, enabled by default
|
|
3086
|
+
* @zh 立即打开连接,默认打开
|
|
3087
|
+
*/
|
|
3088
|
+
immediate?: boolean;
|
|
3089
|
+
/**
|
|
3090
|
+
* @en Automatically reconnect when the connection is disconnected
|
|
3091
|
+
* @zh 连接断开时自动重连
|
|
3092
|
+
*/
|
|
3093
|
+
autoReconnect?: UseFetchEventSourceAutoReconnectOptions;
|
|
3094
|
+
/**
|
|
3095
|
+
* @en Callback when connection opens
|
|
3096
|
+
* @zh 连接打开时的回调
|
|
3097
|
+
*/
|
|
3098
|
+
onOpen?: () => void;
|
|
3099
|
+
/**
|
|
3100
|
+
* @en Callback when message received
|
|
3101
|
+
* @zh 接收到消息时的回调
|
|
3102
|
+
*/
|
|
3103
|
+
onMessage?: (event: UseFetchEventSourceMessage) => void;
|
|
3104
|
+
/**
|
|
3105
|
+
* @en Callback when error occurs, return number to retry after specified milliseconds
|
|
3106
|
+
* @zh 发生错误时的回调,返回数字表示多少毫秒后重试
|
|
3107
|
+
*/
|
|
3108
|
+
onError?: (error: Error) => number | void | null | undefined;
|
|
3109
|
+
/**
|
|
3110
|
+
* @en Callback when connection closes
|
|
3111
|
+
* @zh 连接关闭时的回调
|
|
3112
|
+
*/
|
|
3113
|
+
onClose?: () => void;
|
|
3114
|
+
}
|
|
3115
|
+
/**
|
|
3116
|
+
* @title UseFetchEventSourceMessage
|
|
3117
|
+
*/
|
|
3118
|
+
interface UseFetchEventSourceMessage {
|
|
3119
|
+
/**
|
|
3120
|
+
* @en The event ID
|
|
3121
|
+
* @zh 事件 ID
|
|
3122
|
+
*/
|
|
3123
|
+
id: string | null;
|
|
3124
|
+
/**
|
|
3125
|
+
* @en The event type
|
|
3126
|
+
* @zh 事件类型
|
|
3127
|
+
*/
|
|
3128
|
+
event: string | null;
|
|
3129
|
+
/**
|
|
3130
|
+
* @en The event data
|
|
3131
|
+
* @zh 事件数据
|
|
3132
|
+
*/
|
|
3133
|
+
data: string;
|
|
3134
|
+
}
|
|
3135
|
+
/**
|
|
3136
|
+
* @title UseFetchEventSourceReturn
|
|
3137
|
+
*/
|
|
3138
|
+
interface UseFetchEventSourceReturn {
|
|
3139
|
+
/**
|
|
3140
|
+
* @en The data received
|
|
3141
|
+
* @zh 接收到的数据
|
|
3142
|
+
*/
|
|
3143
|
+
data: string | null;
|
|
3144
|
+
/**
|
|
3145
|
+
* @en The error occurred
|
|
3146
|
+
* @zh 发生的错误
|
|
3147
|
+
*/
|
|
3148
|
+
error: Error | null;
|
|
3149
|
+
/**
|
|
3150
|
+
* @en The status of the connection
|
|
3151
|
+
* @zh 连接的状态
|
|
3152
|
+
*/
|
|
3153
|
+
status: UseFetchEventSourceStatus;
|
|
3154
|
+
/**
|
|
3155
|
+
* @en The last event ID
|
|
3156
|
+
* @zh 最后的事件 ID
|
|
3157
|
+
*/
|
|
3158
|
+
lastEventId: string | null;
|
|
3159
|
+
/**
|
|
3160
|
+
* @en The event name
|
|
3161
|
+
* @zh 事件名
|
|
3162
|
+
*/
|
|
3163
|
+
event: string | null;
|
|
3164
|
+
/**
|
|
3165
|
+
* @en Close the connection
|
|
3166
|
+
* @zh 关闭连接
|
|
3167
|
+
*/
|
|
3168
|
+
close: () => void;
|
|
3169
|
+
/**
|
|
3170
|
+
* @en Open the connection
|
|
3171
|
+
* @zh 打开连接
|
|
3172
|
+
*/
|
|
3173
|
+
open: () => void;
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* @title UseFetchEventSource
|
|
3177
|
+
*/
|
|
3178
|
+
type UseFetchEventSource = (
|
|
3179
|
+
/**
|
|
3180
|
+
* @en The URL of the server-sent event
|
|
3181
|
+
* @zh 服务器发送事件的 URL
|
|
3182
|
+
*/
|
|
3183
|
+
url: string | URL,
|
|
3184
|
+
/**
|
|
3185
|
+
* @en EventSource options
|
|
3186
|
+
* @zh EventSource 选项
|
|
3187
|
+
*/
|
|
3188
|
+
options?: UseFetchEventSourceOptions) => UseFetchEventSourceReturn;
|
|
3189
|
+
|
|
3190
|
+
declare const useFetchEventSource: UseFetchEventSource;
|
|
3191
|
+
|
|
3034
3192
|
/**
|
|
3035
3193
|
* @title useDocumentVisiblity
|
|
3036
3194
|
* @returns_en document visibility
|
|
@@ -3438,4 +3596,4 @@ type Use = <T>(
|
|
|
3438
3596
|
*/
|
|
3439
3597
|
usable: Usable<T>) => T;
|
|
3440
3598
|
|
|
3441
|
-
export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePreferredLanguages, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|
|
3599
|
+
export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFetchEventSource, type UseFetchEventSourceAutoReconnectOptions, type UseFetchEventSourceMessage, type UseFetchEventSourceOptions, type UseFetchEventSourceReturn, type UseFetchEventSourceStatus, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePreferredLanguages, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import Cookies from 'js-cookie';
|
|
|
4
4
|
import { DebounceSettings, ThrottleSettings, DebouncedFunc as DebouncedFunc$1 } from 'lodash-es';
|
|
5
5
|
import * as lodash from 'lodash';
|
|
6
6
|
import { DebounceSettings as DebounceSettings$1, DebouncedFunc, ThrottleSettings as ThrottleSettings$1 } from 'lodash';
|
|
7
|
+
import { FetchEventSourceInit } from '@microsoft/fetch-event-source';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @title useActiveElement
|
|
@@ -3031,6 +3032,163 @@ interface UseElementByPointReturn<M extends boolean> extends Pausable$1 {
|
|
|
3031
3032
|
|
|
3032
3033
|
declare const useElementByPoint: UseElementByPoint;
|
|
3033
3034
|
|
|
3035
|
+
/**
|
|
3036
|
+
* @title UseFetchEventSourceStatus
|
|
3037
|
+
* @description Connection status of EventSource
|
|
3038
|
+
*/
|
|
3039
|
+
type UseFetchEventSourceStatus = 'CONNECTING' | 'CONNECTED' | 'DISCONNECTED';
|
|
3040
|
+
/**
|
|
3041
|
+
* @title UseFetchEventSourceAutoReconnectOptions
|
|
3042
|
+
*/
|
|
3043
|
+
interface UseFetchEventSourceAutoReconnectOptions {
|
|
3044
|
+
/**
|
|
3045
|
+
* @en The number of retries, if it is a function, it will be called to determine whether to retry
|
|
3046
|
+
* @zh 重试次数,如果是函数,会调用来判断是否重试
|
|
3047
|
+
*/
|
|
3048
|
+
retries?: number | (() => boolean);
|
|
3049
|
+
/**
|
|
3050
|
+
* @en The delay time before reconnecting (ms)
|
|
3051
|
+
* @zh 重连前的延迟时间(毫秒)
|
|
3052
|
+
*/
|
|
3053
|
+
delay?: number;
|
|
3054
|
+
/**
|
|
3055
|
+
* @en Callback when reconnection fails
|
|
3056
|
+
* @zh 重连失败时的回调
|
|
3057
|
+
*/
|
|
3058
|
+
onFailed?: () => void;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* @title UseFetchEventSourceOptions
|
|
3062
|
+
*/
|
|
3063
|
+
interface UseFetchEventSourceOptions extends Omit<FetchEventSourceInit, 'signal'> {
|
|
3064
|
+
/**
|
|
3065
|
+
* @en HTTP method for the request
|
|
3066
|
+
* @zh HTTP 请求方法
|
|
3067
|
+
*/
|
|
3068
|
+
method?: string;
|
|
3069
|
+
/**
|
|
3070
|
+
* @en Request headers
|
|
3071
|
+
* @zh 请求头
|
|
3072
|
+
*/
|
|
3073
|
+
headers?: Record<string, string>;
|
|
3074
|
+
/**
|
|
3075
|
+
* @en Request body for POST requests
|
|
3076
|
+
* @zh POST 请求的请求体
|
|
3077
|
+
*/
|
|
3078
|
+
body?: any;
|
|
3079
|
+
/**
|
|
3080
|
+
* @en Use credentials
|
|
3081
|
+
* @zh 使用凭证
|
|
3082
|
+
*/
|
|
3083
|
+
withCredentials?: boolean;
|
|
3084
|
+
/**
|
|
3085
|
+
* @en Immediately open the connection, enabled by default
|
|
3086
|
+
* @zh 立即打开连接,默认打开
|
|
3087
|
+
*/
|
|
3088
|
+
immediate?: boolean;
|
|
3089
|
+
/**
|
|
3090
|
+
* @en Automatically reconnect when the connection is disconnected
|
|
3091
|
+
* @zh 连接断开时自动重连
|
|
3092
|
+
*/
|
|
3093
|
+
autoReconnect?: UseFetchEventSourceAutoReconnectOptions;
|
|
3094
|
+
/**
|
|
3095
|
+
* @en Callback when connection opens
|
|
3096
|
+
* @zh 连接打开时的回调
|
|
3097
|
+
*/
|
|
3098
|
+
onOpen?: () => void;
|
|
3099
|
+
/**
|
|
3100
|
+
* @en Callback when message received
|
|
3101
|
+
* @zh 接收到消息时的回调
|
|
3102
|
+
*/
|
|
3103
|
+
onMessage?: (event: UseFetchEventSourceMessage) => void;
|
|
3104
|
+
/**
|
|
3105
|
+
* @en Callback when error occurs, return number to retry after specified milliseconds
|
|
3106
|
+
* @zh 发生错误时的回调,返回数字表示多少毫秒后重试
|
|
3107
|
+
*/
|
|
3108
|
+
onError?: (error: Error) => number | void | null | undefined;
|
|
3109
|
+
/**
|
|
3110
|
+
* @en Callback when connection closes
|
|
3111
|
+
* @zh 连接关闭时的回调
|
|
3112
|
+
*/
|
|
3113
|
+
onClose?: () => void;
|
|
3114
|
+
}
|
|
3115
|
+
/**
|
|
3116
|
+
* @title UseFetchEventSourceMessage
|
|
3117
|
+
*/
|
|
3118
|
+
interface UseFetchEventSourceMessage {
|
|
3119
|
+
/**
|
|
3120
|
+
* @en The event ID
|
|
3121
|
+
* @zh 事件 ID
|
|
3122
|
+
*/
|
|
3123
|
+
id: string | null;
|
|
3124
|
+
/**
|
|
3125
|
+
* @en The event type
|
|
3126
|
+
* @zh 事件类型
|
|
3127
|
+
*/
|
|
3128
|
+
event: string | null;
|
|
3129
|
+
/**
|
|
3130
|
+
* @en The event data
|
|
3131
|
+
* @zh 事件数据
|
|
3132
|
+
*/
|
|
3133
|
+
data: string;
|
|
3134
|
+
}
|
|
3135
|
+
/**
|
|
3136
|
+
* @title UseFetchEventSourceReturn
|
|
3137
|
+
*/
|
|
3138
|
+
interface UseFetchEventSourceReturn {
|
|
3139
|
+
/**
|
|
3140
|
+
* @en The data received
|
|
3141
|
+
* @zh 接收到的数据
|
|
3142
|
+
*/
|
|
3143
|
+
data: string | null;
|
|
3144
|
+
/**
|
|
3145
|
+
* @en The error occurred
|
|
3146
|
+
* @zh 发生的错误
|
|
3147
|
+
*/
|
|
3148
|
+
error: Error | null;
|
|
3149
|
+
/**
|
|
3150
|
+
* @en The status of the connection
|
|
3151
|
+
* @zh 连接的状态
|
|
3152
|
+
*/
|
|
3153
|
+
status: UseFetchEventSourceStatus;
|
|
3154
|
+
/**
|
|
3155
|
+
* @en The last event ID
|
|
3156
|
+
* @zh 最后的事件 ID
|
|
3157
|
+
*/
|
|
3158
|
+
lastEventId: string | null;
|
|
3159
|
+
/**
|
|
3160
|
+
* @en The event name
|
|
3161
|
+
* @zh 事件名
|
|
3162
|
+
*/
|
|
3163
|
+
event: string | null;
|
|
3164
|
+
/**
|
|
3165
|
+
* @en Close the connection
|
|
3166
|
+
* @zh 关闭连接
|
|
3167
|
+
*/
|
|
3168
|
+
close: () => void;
|
|
3169
|
+
/**
|
|
3170
|
+
* @en Open the connection
|
|
3171
|
+
* @zh 打开连接
|
|
3172
|
+
*/
|
|
3173
|
+
open: () => void;
|
|
3174
|
+
}
|
|
3175
|
+
/**
|
|
3176
|
+
* @title UseFetchEventSource
|
|
3177
|
+
*/
|
|
3178
|
+
type UseFetchEventSource = (
|
|
3179
|
+
/**
|
|
3180
|
+
* @en The URL of the server-sent event
|
|
3181
|
+
* @zh 服务器发送事件的 URL
|
|
3182
|
+
*/
|
|
3183
|
+
url: string | URL,
|
|
3184
|
+
/**
|
|
3185
|
+
* @en EventSource options
|
|
3186
|
+
* @zh EventSource 选项
|
|
3187
|
+
*/
|
|
3188
|
+
options?: UseFetchEventSourceOptions) => UseFetchEventSourceReturn;
|
|
3189
|
+
|
|
3190
|
+
declare const useFetchEventSource: UseFetchEventSource;
|
|
3191
|
+
|
|
3034
3192
|
/**
|
|
3035
3193
|
* @title useDocumentVisiblity
|
|
3036
3194
|
* @returns_en document visibility
|
|
@@ -3438,4 +3596,4 @@ type Use = <T>(
|
|
|
3438
3596
|
*/
|
|
3439
3597
|
usable: Usable<T>) => T;
|
|
3440
3598
|
|
|
3441
|
-
export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePreferredLanguages, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|
|
3599
|
+
export { type ColorScheme, type Contrast, type DepsEqualFnType, type EventSourceStatus, type EventType, type INetworkInformation, type IUseNetworkState, type KeyModifier, type Pausable, type Platform, type PossibleRef, type Use, type UseActiveElement, type UseAsyncEffect, type UseBroadcastChannel, type UseBroadcastChannelOptions, type UseBroadcastChannelReturn, type UseClickOutside, type UseClipboard, type UseControlled, type UseCookie, type UseCookieState, type UseCountDown, type UseCounter, type UseCssVar, type UseCssVarOptions, type UseCustomCompareEffect, type UseCycleList, type UseDarkMode, type UseDarkOptions, type UseDebounce, type UseDebounceFn, type UseDeepCompareEffect, type UseDevicePixelRatio, type UseDevicePixelRatioReturn, type UseDisclosure, type UseDisclosureProps, type UseDocumentVisibility, type UseDoubleClick, type UseDoubleClickProps, type UseDraggable, type UseDraggableOptions, type UseDropZone, type UseElementBounding, type UseElementBoundingOptions, type UseElementBoundingReturn, type UseElementByPoint, type UseElementByPointOptions, type UseElementByPointReturn, type UseElementSize, type UseElementVisibility, type UseEvent, type UseEventEmitter, type UseEventEmitterDisposable, type UseEventEmitterEvent, type UseEventEmitterEventOnce, type UseEventEmitterListener, type UseEventEmitterReturn, type UseEventListener, type UseEventSource, type UseEventSourceAutoReconnectOptions, type UseEventSourceOptions, type UseEventSourceReturn, type UseEyeDropper, type UseEyeDropperOpenOptions, type UseEyeDropperOpenReturnType, type UseFavicon, type UseFetchEventSource, type UseFetchEventSourceAutoReconnectOptions, type UseFetchEventSourceMessage, type UseFetchEventSourceOptions, type UseFetchEventSourceReturn, type UseFetchEventSourceStatus, type UseFileDialog, type UseFileDialogOptions, type UseFirstMountState, type UseFocus, type UseFps, type UseFpsOptions, type UseFullScreenOptions, type UseFullscreen, type UseGeolocation, type UseHover, type UseIdle, type UseInfiniteScroll, type UseInfiniteScrollArrivedState, type UseInfiniteScrollDirection, type UseInfiniteScrollLoadMore, type UseInfiniteScrollOptions, type UseIntersectionObserver, type UseInterval, type UseIntervalOptions, type UseKeyModifier, type UseLatest, type UseLocalStorage, type UseLocalStorageOptions, type UseLocalStorageSerializer, type UseLocationSelector, type UseLongPress, type UseLongPressOptions, type UseMeasure, type UseMeasureRect, type UseMediaDeviceOptions, type UseMediaDevices, type UseMediaQuery, type UseMergedRef, type UseMobileLandscape, type UseModifierOptions, type UseMount, type UseMountedState, type UseMouse, type UseMouseCursorState, type UseMousePressed, type UseMousePressedOptions, type UseMousePressedSourceType, type UseMutationObserver, type UseNetwork, type UseObjectUrl, type UseOnline, type UseOrientation, type UseOrientationLockType, type UseOrientationState, type UseOrientationType, type UsePageLeave, type UsePermission, type UsePermissionDescriptorNamePolyfill, type UsePermissionGeneralPermissionDescriptor, type UsePermissionState, type UsePlatform, type UsePlatformProps, type UsePlatformReturn, type UsePreferredColorScheme, type UsePreferredContrast, type UsePreferredDark, type UsePreferredLanguages, type UsePrevious, type UseRafFn, type UseRafState, type UseReducedMotion, type UseResizeObserver, type UseScreenSafeArea, type UseScriptTag, type UseScriptTagOptions, type UseScriptTagStatus, type UseScroll, type UseScrollArrivedState, type UseScrollDirection, type UseScrollIntoView, type UseScrollIntoViewAnimation, type UseScrollIntoViewParams, type UseScrollLock, type UseScrollOffset, type UseScrollOptions, type UseSessionStorage, type UseSessionStorageOptions, type UseSessionStorageSerializer, type UseSetState, type UseSticky, type UseStickyParams, type UseSupported, type UseTextDirection, type UseTextDirectionOptions, type UseTextDirectionValue, type UseTextSelection, type UseThrottle, type UseThrottleFn, type UseTimeout, type UseTimeoutFn, type UseTimeoutFnOptions, type UseTimeoutOptions, type UseTitle, type UseToggle, type UseUnmount, type UseUpdate, type UseWebNotification, type UseWebNotificationReturn, type UseWebNotificationShow, type UseWindowScroll, type UseWindowScrollState, type UseWindowSize, type UseWindowsFocus, assignRef, defaultOptions, mergeRefs, use, useActiveElement, useAsyncEffect, useBroadcastChannel, useClickOutside, useClipboard, useControlled, useCookie, useCountDown, useCounter, useCssVar, useCustomCompareEffect, useCycleList, useDarkMode, useDebounce, useDebounceFn, useDeepCompareEffect, useDevicePixelRatio, useDisclosure, useDocumentVisibility, useDoubleClick, useDraggable, useDropZone, useElementBounding, useElementByPoint, useElementSize, useElementVisibility, useEvent, useEventEmitter, useEventListener, useEventSource, useEyeDropper, useFavicon, useFetchEventSource, useFileDialog, useFirstMountState, useFocus, useFps, useFullscreen, useGeolocation, useHover, useIdle, useInfiniteScroll, useIntersectionObserver, useInterval, useIsomorphicLayoutEffect, useKeyModifier, useLatest, useLocalStorage, useLocationSelector, useLongPress, useMeasure, useMediaDevices, useMediaQuery, useMergedRefs, useMobileLandscape, useMount, useMountedState, useMouse, useMousePressed, useMutationObserver, useNetwork, useObjectUrl, useOnceEffect, useOnceLayoutEffect, useOnline, useOrientation, usePageLeave, usePermission, usePlatform, usePreferredColorScheme, usePreferredContrast, usePreferredDark, usePreferredLanguages, usePrevious, useRafFn, useRafState, useReducedMotion, useResizeObserver, useScreenSafeArea, useScriptTag, useScroll, useScrollIntoView, useScrollLock, useSessionStorage, useSetState, useSticky, useSupported, useTextDirection, useTextSelection, useThrottle, useThrottleFn, useTimeout, useTimeoutFn, useTitle, useToggle, useUnmount, useUpdate, useUpdateEffect, useUpdateLayoutEffect, useWebNotification, useWindowScroll, useWindowSize, useWindowsFocus };
|