Skip to content

Commit 64c653d

Browse files
committed
feat(examples): update with-lodash
1 parent 57745ff commit 64c653d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

examples/with-lodash/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"vite": "4.0.4"
1515
},
1616
"dependencies": {
17+
"@stenodb/browser": "workspace:^0.0.0",
1718
"@zero-dependency/dom": "0.12.0",
1819
"class-transformer": "0.5.1",
1920
"lodash": "4.17.21",
20-
"reflect-metadata": "0.1.13",
21-
"stenodb": "workspace:*"
21+
"reflect-metadata": "0.1.13"
2222
}
2323
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1+
import { BrowserDatabase, LocalStorage } from '@stenodb/browser'
12
import lodash from 'lodash'
2-
import { BrowserProvider, LocalStorage } from 'stenodb/browser'
33
import { User, Users } from './entities.js'
44

5-
class StorageWithLodash extends BrowserProvider<Users> {
5+
const adapter = new LocalStorage('users', Users)
6+
const initialData = new Users(new User(1, 'John'))
7+
8+
class StorageWithLodash extends BrowserDatabase<Users> {
69
chain: lodash.ExpChain<this['data']> = lodash.chain(this).get('data')
710

811
constructor() {
9-
super({
10-
entity: Users,
11-
adapter: new LocalStorage<Users>('users'),
12-
initialData: new Users(new User(1, 'John'))
13-
})
12+
super(adapter, initialData)
1413
}
1514

1615
addUser(user: User): void {
@@ -24,3 +23,4 @@ class StorageWithLodash extends BrowserProvider<Users> {
2423
}
2524

2625
export const storage = new StorageWithLodash()
26+
storage.read()

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)