StoreTests.ts
27 lines
| 693 B
| video/mp2t
|
TypeScriptLexer
cin
|
r2 | import * as Memory from "dojo/store/Memory"; | ||
import * as Observable from "dojo/store/Observable"; | ||||
cin
|
r0 | |||
interface Schedule { | ||||
cin
|
r1 | id?: string; | ||
cin
|
r0 | |||
title: string; | ||||
duration: number; | ||||
} | ||||
declare const store: dojo.store.api.Store<Schedule>; | ||||
const observable = new Observable(store); | ||||
cin
|
r1 | const mem = new Memory<Schedule>(); | ||
cin
|
r2 | observable.query().observe(() => { }); | ||
store.query().forEach(() => { }); | ||||
const total = await store.query().total; | ||||
cin
|
r20 | const res1 = await store.query(undefined, { sort: [{ attribute: "duration", descending: true }] }); | ||
const res2 = await store.query(undefined, { sort: ({ duration: a }, { duration: b }) => a - b }); | ||||
cin
|
r1 | |||
cin
|
r2 | mem.query(); | ||
cin
|
r1 | |||
cin
|
r2 | mem.add({ duration: 10, title: "Test event" }); | ||