Comparing version 3.2.1-beta.1 to 3.2.1-beta.2
@@ -7,3 +7,3 @@ /* | ||
* | ||
* Version 3.2.1-beta.1, Fri Nov 19 2021 | ||
* Version 3.2.1-beta.2, Wed Jan 05 2022 | ||
* | ||
@@ -10,0 +10,0 @@ * https://dexie.org |
{ | ||
"name": "dexie", | ||
"version": "3.2.1-beta.1", | ||
"version": "3.2.1-beta.2", | ||
"description": "A Minimalistic Wrapper for IndexedDB", | ||
@@ -8,3 +8,28 @@ "main": "dist/dexie.js", | ||
"jsnext:main": "dist/dexie.mjs", | ||
"exports": "./dist/modern/dexie.mjs", | ||
"exports": { | ||
".": { | ||
"production": { | ||
"browser": "./dist/modern/dexie.min.mjs", | ||
"module": "./dist/modern/dexie.min.mjs", | ||
"import": "./import-wrapper-prod.mjs", | ||
"require": "./dist/dexie.min.js", | ||
"default": "./dist/dexie.min.js" | ||
}, | ||
"development": { | ||
"browser": "./dist/modern/dexie.mjs", | ||
"module": "./dist/modern/dexie.mjs", | ||
"import": "./import-wrapper.mjs", | ||
"require": "./dist/dexie.js", | ||
"default": "./dist/dexie.js" | ||
}, | ||
"default": { | ||
"browser": "./dist/modern/dexie.mjs", | ||
"module": "./dist/modern/dexie.mjs", | ||
"import": "./import-wrapper.mjs", | ||
"require": "./dist/dexie.js", | ||
"default": "./dist/dexie.js" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"typings": "dist/dexie.d.ts", | ||
@@ -11,0 +36,0 @@ "jspm": { |
@@ -47,4 +47,35 @@ Dexie.js | ||
``` | ||
Yes, it's that simple. | ||
Yes, it's that simple. | ||
An equivalent modern version (works in all modern browsers): | ||
```html | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<script type="module"> | ||
import Dexie from "https://unpkg.com/dexie@latest/dist/modern/dexie.mjs"; | ||
// | ||
// Declare Database | ||
// | ||
const db = new Dexie("FriendDatabase"); | ||
db.version(1).stores({ | ||
friends: "++id,name,age" | ||
}); | ||
// | ||
// Manipulate and Query Database | ||
// | ||
try { | ||
await db.friends.add({name: "Josephine", age: 21}); | ||
const youngFriends = await db.friends.where("age").below(25).toArray(); | ||
alert (`My young friends: ${JSON.stringify(youngFriends)}`); | ||
} catch (e) { | ||
alert (`Error: ${e}`); | ||
} | ||
</script> | ||
</head> | ||
</html> | ||
``` | ||
[Tutorial](https://dexie.org/docs/Tutorial) | ||
@@ -114,36 +145,6 @@ | ||
#### Hello World (ES2016 / ES7) | ||
```js | ||
import Dexie from 'dexie'; | ||
// | ||
// Declare Database | ||
// | ||
const db = new Dexie("FriendDatabase"); | ||
db.version(1).stores({ friends: "++id,name,age" }); | ||
db.transaction('rw', db.friends, async() => { | ||
// Make sure we have something in DB: | ||
if ((await db.friends.where({name: 'Josephine'}).count()) === 0) { | ||
const id = await db.friends.add({name: "Josephine", age: 21}); | ||
alert (`Addded friend with id ${id}`); | ||
} | ||
// Query: | ||
const youngFriends = await db.friends.where("age").below(25).toArray(); | ||
// Show result: | ||
alert ("My young friends: " + JSON.stringify(youngFriends)); | ||
}).catch(e => { | ||
alert(e.stack || e); | ||
}); | ||
``` | ||
#### Hello World (Typescript) | ||
```js | ||
import Dexie from 'dexie'; | ||
import Dexie, { Table } from 'dexie'; | ||
@@ -160,3 +161,3 @@ interface Friend { | ||
class FriendDatabase extends Dexie { | ||
public friends: Dexie.Table<Friend, number>; // id is number in this case | ||
public friends!: Table<Friend, number>; // id is number in this case | ||
@@ -168,3 +169,2 @@ public constructor() { | ||
}); | ||
this.friends = this.table("friends"); | ||
} | ||
@@ -219,9 +219,17 @@ } | ||
https://unpkg.com/dexie@latest/dist/dexie.js | ||
### Legacy: | ||
https://unpkg.com/dexie@latest/dist/dexie.min.js | ||
https://unpkg.com/dexie@latest/dist/dexie.js.map | ||
https://unpkg.com/dexie@latest/dist/dexie.min.js.map | ||
### Modern: | ||
https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs | ||
https://unpkg.com/dexie@latest/dist/modern/dexie.min.mjs.map | ||
### Typings: | ||
https://unpkg.com/dexie@latest/dist/dexie.d.ts | ||
Contributing | ||
@@ -228,0 +236,0 @@ ============ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2574507
20
16295
281