Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaluik committed Feb 24, 2023
1 parent 4096914 commit d855b27
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,6 @@ const store = vstores.create({

```

### Adapters

内置了 4 种适配器适用于不同平台:

web 端:`webAdapter`, `sessionAdapter`
微信小程序:`wxAdapter`
支付宝小程序: `aliAdapter`,

```typescript
import {
webAdapter,
sessionAdapter,
sessionAdapter,
aliAdapter,
} from 'vstores';
```

#### set 方法的配置

```typescript
Expand All @@ -178,6 +161,25 @@ vstores.set('key', data, {

支持 web 端、微信小程序、支付宝小程序,根据不同平台自动适配,无需额外配置

### 跨平台适配器

内置了 4 种适配器适用于不同平台,可以手动指定:

web 端:`webAdapter`(使用 localStorage), `sessionAdapter`(使用 sessionStorage)

微信小程序:`wxAdapter`

支付宝小程序: `aliAdapter`

手动指定适配器方式:

```typescript
import vstores, { sessionAdapter } from 'vstores';
const store = vstores.create({
adapter: sessionAdapter,
});
```

## 版权

MIT © [jaluik](https://github.com/jaluik)
38 changes: 19 additions & 19 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,6 @@ store.set('test', 1);
store.get('test');
```

### Adapters

Built-in 4 adapters for different platforms:

web: `webAdapter`, `sessionAdapter`

wechat-mini: `wxAdapter`

ali-mini: `aliAdapter`

```typescript
import {
webAdapter,
sessionAdapter,
sessionAdapter,
aliAdapter,
} from 'vstores';
```

### Set expire time

```typescript
Expand Down Expand Up @@ -175,6 +156,25 @@ vstores.set('key', data, {

Support web, WeChat miniprogram, Alipay miniprogram, it will be automatic configed according to different platforms, no additional configuration required.

### adapter

There are 4 built-in adapters for different platforms, which can be specified manually:

web :`webAdapter`(use localStorage), `sessionAdapter`(use sessionStorage)

wechat-mini`wxAdapter`

ali mini `aliAdapter`

Manually specify the adapter method:

```typescript
import vstores, { sessionAdapter } from 'vstores';
const store = vstores.create({
adapter: sessionAdapter,
});
```

## Copyright

MIT © [jaluik](https://github.com/jaluik)

0 comments on commit d855b27

Please sign in to comment.