New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

yux-storage

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yux-storage - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "yux-storage",
"version": "1.0.2",
"version": "1.0.3",
"description": "yux-storage 是一个基于 HTML5 IndexedDB 封装的 Web 本地数据离线存储库",

@@ -5,0 +5,0 @@ "main": "yux-storage.js",

@@ -28,4 +28,10 @@ # yux-storage

2. 通过 [npm](https://www.npmjs.com/package/yux-storage) 安装
2. 直接使用 unpkg [在线链接](https://unpkg.com/yux-storage)
```html
<script src="https://unpkg.com/yux-storage"></script>
```
3. 通过 [npm](https://www.npmjs.com/package/yux-storage) 安装
```cmd

@@ -52,3 +58,3 @@ npm i yux-storage

// 同样支持promise
yuxStorage.setItem('key').then(doSomethingElse)
yuxStorage.getItem('key').then(doSomethingElse)

@@ -60,2 +66,4 @@ // 如果你的环境支持async,那么

> 如果出现报错,可查看下面的[注意事项](#注意事项)
## API

@@ -197,3 +205,3 @@

yuxStorage.key(2).then(function(keyName) {
// key 名
// key名
console.log(keyName);

@@ -217,3 +225,3 @@ })

yuxStorage.keys().then(function(keyNames) {
// key 名
// 所有的key名
console.log(keyNames);

@@ -231,3 +239,3 @@ })

默认情况下,内部会暴露一个全局变量 yuxStorage,由于 indexedDB 的打开或者创建都是异步的,可能会出现以下报错
默认情况下,内部会暴露一个全局变量 yuxStorage,由于 indexedDB 的打开或者创建都是异步的,如果在页面加载后立即调用以上 API,可能会出现以下报错

@@ -238,3 +246,3 @@ ```js

这时,只需要将方法放在 `new yuxDB()` 的回调或者 Promise 后续流程
这时,只需要将方法放在 `new yuxDB()` 的回调或者 Promise 后续流程就可以了

@@ -254,3 +262,3 @@ ```js

// 回调方式
new YuxDB(function(yuxStorage){
new yuxDB(function(yuxStorage){
// 初始化完成

@@ -257,0 +265,0 @@ yuxStorage.getItem('somekey')

/**
* @yux-storage.js
* @author xboxyan
* @email yanwenbin1991@live.com
* Created: 20-11-10

@@ -5,0 +6,0 @@ */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc