Download wp-calypso/client/dashboard/app/queries/performance.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/app/queries/performance.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/dashboard/app/queries/performance.ts
-
curl -L -o performance.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/dashboard/app/queries/performance.ts
734 Bytes
| import { fetchBasicMetrics, fetchPerformanceInsights } from '../../data/site-profiler'; | |
| import type { UrlPerformanceInsights } from '../../data/site-profiler'; | |
| import type { Query } from '@tanstack/react-query'; | |
| export const basicMetricsQuery = ( url: string ) => ( { | |
| queryKey: [ 'performance', url, 'basic-metrics' ], | |
| queryFn: () => fetchBasicMetrics( url ), | |
| } ); | |
| export const performanceInsightsQuery = ( url: string, token: string ) => ( { | |
| queryKey: [ 'performance', url, token ], | |
| queryFn: () => { | |
| return fetchPerformanceInsights( url, token ); | |
| }, | |
| refetchInterval: ( query: Query< UrlPerformanceInsights > ) => { | |
| if ( query.state.data?.pagespeed?.status === 'completed' ) { | |
| return false; | |
| } | |
| return 5000; | |
| }, | |
| } ); | |