Skip to content

Commit

Permalink
调整导出
Browse files Browse the repository at this point in the history
  • Loading branch information
汪航洋 committed Aug 2, 2023
1 parent 42dd024 commit 138a9af
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
### 简单 KV 库实现

```js
import idbOpen from "idb-open-plush";
import { idbOpen } from "idb-open-plush";

class IdbKV {
constructor(dbName, store) {
Expand Down Expand Up @@ -58,7 +58,7 @@ console.log(await kv1.get("key2"));
### 搭配`idb`库使用 代码变得更丝滑

```js
import idbOpen from "idb-open-plush";
import { idbOpen } from "idb-open-plush";
import { openDB, wrap, unwrap } from "idb";

class IdbKV {
Expand Down Expand Up @@ -114,7 +114,7 @@ type InitOptions = {
### 约定式创建/更新 `ObjectStore`

```typescript
import idbOpen from "idb-open";
import { idbOpen } from "idb-open-plush";

function getDB() {
// return idbOpen("db1", { store: "st1|++,name" }); // 只有一个ObjectStore时可以这样简写
Expand Down Expand Up @@ -171,7 +171,7 @@ function getDB() {
### 自定义创建/更新 `ObjectStore`

```typescript
import idbOpen from "idb-open";
import { idbOpen } from "idb-open-plush";

const getDB = async () => {
return idbOpen("db1", {
Expand Down
8 changes: 5 additions & 3 deletions demo/demo.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { openDB, wrap, unwrap } from "idb";
import { idbOpen, idbDelete } from "../src/";
// const { idbOpen, idbDelete } = window.idbOpen;
import idbOpen from "../";
import { idbDelete } from "../";

window.idbOpen = idbOpen;
// const { idbOpen, idbDelete } = window.idbOpenPlush;

// window.idbOpen = idbOpen;

/**
* 实现给我和简单人kv库
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "idb-open-plush",
"version": "1.0.1",
"version": "1.0.2",
"description": "Open indexedDb to get the Database you need",
"main": "dist/idb-open-plush.cjs.js",
"browser": "dist/idb-open-plush.umd.js",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ import { create } from "./create";
export * from "./create";
const def = create(window);
export const { idbOpen, idbDelete } = def;
export default idbOpen;
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ export default defineConfig({
sourcemap: true,
target: "es2015",
// minify: false,
rollupOptions: {
output: {
exports: "named",
},
}
},
});

0 comments on commit 138a9af

Please sign in to comment.