Giter Club home page Giter Club logo

localforage-adapter's Introduction

@uni-helper/localforage-adapter

NPM version

安装

# pnpm
pnpm install @uni-helper/localforage-adapter
# npm
npm install @uni-helper/localforage-adapter --save
# yarn
yarn add @uni-helper/localforage-adapter

使用

  • uniStorageDriver:使用uni-app内置的storage API,支持所有平台,但是性能较差,不建议在H5端和App端使用,仅建议小程序端使用
  • sqliteDriver:使用基座包提供的SQLite模块,仅支持App端,性能较好,建议在App端使用
import { uniStorageDriver, sqliteDriver } from "@uni-helper/localforage-adapter"
import localforage from "localforage"

localforage.defineDriver(uniStorageDriver); // 全端支持,但是还是建议在H5端使用lf自带的IndexedDB
localforage.defineDriver(sqliteDriver); // 仅支持APP端,并需要基座包支持SQLite模块
// 可以使用 #ifdef 等UniAPP特有条件编译注释符
localforage.setDriver([ //会按顺序依次尝试,直到找到可用的驱动
  sqliteDriver._driver // 或者"sqliteDriver"
  uniStorageDriver._driver // 或者"uniStorageDriver"
]);

License

MIT License © 2023-PRESENT Uni-Helper

localforage-adapter's People

Contributors

censujiang avatar isafive avatar renovate[bot] avatar slideslide avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

localforage-adapter's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yml
  • actions/checkout v4
  • pnpm/action-setup v2
  • actions/setup-node v4
npm
package.json
  • @antfu/eslint-config 1.0.0-beta.27
  • @types/node ^20.8.6
  • bumpp ^9.2.0
  • eslint ^8.51.0
  • esno ^0.17.0
  • localforage ^1.10.0
  • rimraf ^5.0.5
  • typescript ^5.2.2
  • unbuild ^2.0.0
  • vite ^4.4.11
  • vitest ^0.34.6
  • pnpm 8.9.0

  • Check this box to trigger a request for Renovate to run again on this repository

defineDriver(uniStorageDriver)类型错误

描述问题

类型“{ _driver: string; _support: () => boolean; _initStorage: (options: any) => Promise; clear: (callback: any) => any; getItem: (key: any, callback: any) => any; iterate: (iterator: any, callback: any) => any; ... 5 more ...; dropInstance: (options: any, callback: any) => any; }”的参数不能赋给类型“LocalForageDriver”的参数。
属性“_support”的类型不兼容。
不能将类型“() => boolean”分配给类型“boolean | LocalForageDriverSupportFunc”。
不能将类型“() => boolean”分配给类型“LocalForageDriverSupportFunc”。
不能将类型“boolean”分配给类型“Promise”。ts(2345)

复现

image

系统信息

基础环境信息:

  • os: macOS 14.5
  • node: 20.11.0
  • vscode: 1.90.0
  • volar: 2.0.19

基础依赖信息:

  • vue: 3.4.27
  • vite: 5.2.8
  • @dcloudio/uni-app: 3.0.0-alpha-4010820240603001

使用的包管理器

pnpm

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现

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.