@rxliuli/vista ??: ????? ???? Fetch ? XHR? ?? ?? ???? ????????.
Jan 07, 2025 am 12:19 AM
@rxliuli/vista? Fetch/XHR ??? ?? ????? ???? ??? ?? ?? ???? ????????. ?? ?? ?? ??????? ??? ??? ??? ? ?? ?? ????, ??, ?? ? ??? ??? ??????.
??
- ? Fetch ? XHR ?? ??? ?? ?????
- ? ???? ???? ?? ???? ??? ?????
- ? ?? ?? ?? ??
- ? ?? ??? ?? ? ?? ???
- ? ??? ??, ???? ???
- ? ???? ??? ??
??
npm install @rxliuli/vista # Or yarn add @rxliuli/vista # Or pnpm add @rxliuli/vista
?? ???
import { Vista } from '@rxliuli/vista' new Vista() .use(async (c, next) => { console.log('Request started:', c.req.url) await next() }) .use(async (c, next) => { await next() console.log('Response data:', await c.res.clone().text()) }) .intercept()
?? ?? ??
?? ?? ?? ??
new Vista() .use(async (c, next) => { c.req.headers.set('Authorization', 'Bearer token') await next() }) .intercept()
?? ?? ??
const cache = new Map() new Vista() .use(async (c, next) => { const key = c.req.url if (cache.has(key)) { c.res = cache.get(key).clone() return } await next() cache.set(key, c.res.clone()) }) .intercept()
??? ??????. ?? ??? ???.
new Vista() .use(async (c, next) => { const maxRetries = 3 let retries = 0 while (retries < maxRetries) { try { await next() break } catch (err) { retries++ if (retries === maxRetries) throw err } } }) .intercept()
?? ?? ??
new Vista() .use(async (c, next) => { await next() if (c.req.url === 'https://example.com/example') { const json = await c.res.json() json.id = 2 c.res = new Response(JSON.stringify(json), c.res) } }) .intercept()
API ??
??? ???
?? ???? ???? ?? ???? ???:
- ??(????): ???? ??
- Intercept(): ?? ?? ??
- destroy(): ?? ???? ??
???? ????
???? ??? ? ?? ????? ????:
-
context: ?? ? ?? ??? ?????.
- req: ?? ?? res: ?? ??
- ??: ?? ??, ???? ?? xhr
- next: ?? ???? ?? ?? ??? ??? ?????
FAQ
- ??? ???? ??? ??????
const vista = new Vista() vista.intercept() // When not needed vista.destroy()
??? ??? ??????
?, ????? async/await ??? ?????.Node.js?? ?? ??? ??????
???, ??????? ?? ??? ?????.
????
- xhook: xhr ??? ???? ?????? ?? ?? ??? ??? ???.
- hono: API?? ?? ??? ?? ??? ? ?? ????????.
?? ??
?? ? ? ?? ??? ?????!
??
MIT ????
????? ??? ?????. ??? ??? ?? ???? ?????.
? ??? @rxliuli/vista ??: ????? ???? Fetch ? XHR? ?? ?? ???? ????????.? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











Java ? JavaScript? ?? ?? ????? ??? ?? ?? ?? ???? ????? ?????. Java? ??? ? ??? ?????? ??? ???? JavaScript? ?? ? ??? ??? ?????.

JavaScriptCommentsareEnsentialformaining, ?? ? ???? 1) Single-LinecommentsERUSEDFORQUICKEXPLANATIONS.2) Multi-linecommentSexplaincleClexLogicOrprovidedEdeDDocumentation.3) inlineecommentsClarifySpecificPartSofcode.bestPractic

JavaScript?? ??? ??? ?? ? ? ?? ??? ???????. 1. ?? ??? ??? ???? ?? ??? ????. ISO ?? ???? ???? ???? ???? ?? ????. 2. ?? ??? ?? ???? ??? ?? ???? ??? ? ??? ? ?? 0?? ????? ?? ??????. 3. ?? ?? ???? ???? ???? ?? ?????? ??? ? ????. 4. Luxon? ?? ???? ???? ?????? ???? ?? ????. ??? ?? ???? ????? ???? ??? ????? ?? ? ????.

TAGGSATTHEBOTTOMOFABLOGPOSTORWEBPAGESERVESPRACTICALPURSEO, USEREXPERIENCE, andDESIGN.1.ITHELPSWITHEOBYOWNSESPORENGENSTOESTOCESKESKERKESKERKERKERDER-RELEVANTTAGSWITHOUTHINGTEMAINCONTENT.2.ITIMPROVESEREXPERKEEPINGTOPONTEFOCUSOFOFOFOCUSOFOFOFOCUCUSONTHEATECLL

JavaScriptIspreferredforwebDevelopment, whithjavaisbetterforlarge-scalebackendsystemsandandandoidapps.1) javascriptexcelsincreatinginteractivewebexperiences withitsdynatureanddommanipulation.2) javaoffersstrongtypingandobject-Orientededededededededededededededededdec

javascriptassevenfundamentalDatatatypes : ??, ???, ??, unull, ??, ? symbol.1) ?? seAdouble-precisionformat, ??? forwidevaluerangesbutbecautiouswithfatingfointarithmetic.2) stringsareimmutable, useefficientconcatenationmethendsf

??? ?? ? ??? DOM?? ??? ??? ? ?????. ??? ?? ????? ?? ??????, ??? ?? ???? ?? ????????. 1. ??? ??? addeventListener? usecapture ?? ??? true? ???? ?????. 2. ??? ??? ?? ???? usecapture? ???? ????? ?????. 3. ??? ??? ??? ??? ???? ? ??? ? ????. 4. ??? ?? ?? ?? ??? ?? ??? ??????? ??? ???? ?????. 5. ??? ?? ?? ?? ??? ?? ???? ?? ???? ? ??? ? ????. ? ? ??? ???? ???? JavaScript? ??? ??? ??? ????? ???? ???? ??? ??????.

Java? JavaScript? ?? ????? ?????. 1. Java? ???? ???? ??? ? ??? ?????? ?????? ? ?? ???? ?????. 2. JavaScript? ?? ? ?? ?? ? ??? ?? ??? ???? ??? ? ?? ? ?? ?????.
