Code Monkey home page Code Monkey logo

lyla's Introduction

07akioni

China, Beijing.

I build user interface.

lyla's People

Contributors

07akioni avatar chengazhen avatar cijiugechu avatar xiezongchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lyla's Issues

ts 类型错误

下面代码中使用了 body 传递参数的时候会出现类型报错

在跳转到对应的类型声明时是

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'
  }
})

support cdn import ?

是否有准备支持 script 引入的打算呢? 如果想用html写个demo, 好像是不可以的

ReferenceError: XMLHttpRequest is not defined

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

LylaResponseError 报错, 没有这个模块

使用文档

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';

[question] vite build fail on the browser

hi,

when i use this in vite, the lastst version had 2 issue。
image

  1. i find use node version not browser version when i use it on the browser.
  2. using a destructuring pipline is a error, and build fail.

thanks.

[feat request] export options when createInstance

Export options here:

return {
lyla: Object.assign(request, {
get: createRequestShortcut('get'),
post: createRequestShortcut('post'),
put: createRequestShortcut('put'),
patch: createRequestShortcut('patch'),
head: createRequestShortcut('head'),
delete: createRequestShortcut('delete'),
options: createRequestShortcut('options'),
trace: createRequestShortcut('trace'),
connect: createRequestShortcut('connect')
}),
isLylaError(e: unknown): e is LylaError<C, M> {
return _isLylaError(e)
}
}
}

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) => {
  // ...
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.