China, Beijing.
I build user interface.
A fully typed HTTP client with explicit behavior & error handling.
是否考虑增加一个uniapp的模块呢 ? 通过逻辑观察 wx 模块的基本可以兼容到 uniapp
在跳转到对应的类型声明时是
export interface LylaAdapterMeta {
method: LylaMethod;
requestBody: any | undefined;
responseType: 'arraybuffer' | 'blob' | 'text';
responseBody: any;
networkErrorDetail: any;
responseDetail: any;
progressDetail: any;
originalRequest: any;
}
对象字面量只能指定已知属性,并且“name”不在类型“ArrayBuffer”中。ts(2353)
types.d.ts(22, 5): 所需类型来自属性 "body",在此处的 "LylaRequestOptions<null, LylaAdapterMeta>" 类型上声明该属性
lyla({
url: '/api/lyla',
method: 'post',
body: {
name: 'lyla'
}
})
Add fetch adapter. So that lyla can be use on both modern browsers and Node.js
是否有准备支持 script 引入的打算呢? 如果想用html写个demo, 好像是不可以的
I already use lyla in a big project, everything works exceptionally well, but now I am trying to use it in a new project and I keep getting this error :
D:\projetos\ledoctor2\whatsappweb\node_modules.pnpm\[email protected]\node_modules\lyla\lib\index.js:528
const xhr = new XMLHttpRequest();
^
is something broken ?
Regards
使用文档
import type { LylaResponseError } from 'lyla'
看了插件代码, 导出里面没有这个类型 LylaResponseError
export type { LylaRequestOptions, LylaResponse, LylaProgress, Lyla } from './types.js';
export { lyla } from './instance.js';
export type { MatchError, CatchError, LylaErrorHandler } from './error.js';
export { catchError, matchError, isLylaError, LYLA_ERROR } from './error.js';
Export options here:
lyla/packages/core/src/core.ts
Lines 534 to 550 in 4f6152b
So that we can modify options or hooks after instance created.
e.g.
const { lyla, options } = createLyla({ /* ... */ })
options.hooks ??= {}
options.hooks.onBeforeRequest ??= []
options.hooks.onBeforeRequest.push((ctx) => {
// ...
})
It's kind of like axios.interceptors
does:
const request = axios.create({ /* ... */ })
request.interceptors.request.use((ctx) => {
// ...
})
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.