# js-leancloud-library **Repository Path**: mokelao/js-leancloud-library ## Basic Information - **Project Name**: js-leancloud-library - **Description**: 一个基于leancloud API的js封装库 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: http://pawner.cn/ - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 0 - **Created**: 2022-05-05 - **Last Updated**: 2023-11-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # js-leancloud-library #### 介绍 js-leancloud-library是一个基于js的leancloud API封装库(感谢leancloud的无私奉献),开发初衷是因为leancloud官方使用方式不够便捷,且学习成本较高,目前插件拥有api的链式化调用,响应/请求拦截,自定义方法等实现。 #### 安装 注意,NPM安装不支持 IE11兼容模式 ``` npm i @mokelao/leancloud-library ``` #####OR 暂未提供CDN,请自行下载引入 >[bundle.esm.js](https://gitee.com/mokelao/js-leancloud-library/blob/master/dist/bundle.esm.js) [bundle.common.js](https://gitee.com/mokelao/js-leancloud-library/blob/master/dist/bundle.common.js) [bundle.js](https://gitee.com/mokelao/js-leancloud-library/blob/master/dist/bundle.js) ```javascript ``` #### 使用 ```javascript const $http = new LC({ appId: xxx, appKey: xxx, // serverURL: xxx, }); // 响应拦截 $http.interceptors.request.use( (config) => { ... // throw new Rrror('no') }, (err) => { return Promise.reject(err) } ) // 请求拦截 $http.interceptors.response.use( (config) => { if (config) { ... return config } return false }, (err) => { return Promise.reject(err) } ) ``` #### License MIT Copyright (c) 2021-present, antree