-
Notifications
You must be signed in to change notification settings - Fork 3
/
protocols.cljs
106 lines (87 loc) · 2.55 KB
/
protocols.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
(ns indexed.db.impl.protocols
"Most of the protocols in this namespace map directly to native JS types
for the IndexedDB API. Where possible, JS properties and methods are mapped
to conventional Clojure names (i.e kebab case vs camel case).
This library adds a handful of protocols, such as HasErrors, EventTarget, and the BelongsToX
protocols to address cross cutting concerns present in the native JS API."
(:refer-clojure :exclude [count key get update]))
(defprotocol IDBFactory
(open [self name version] [self name])
(delete-database [self name])
(cmp [self a b])
(databases [self fn-1]))
(defprotocol IDBDatabase
(close [self])
(version [self])
(create-object-store [self name options])
(delete-object-store [self name])
(object-store-names [self])
(transaction [self store-names mode options]))
(defprotocol HasErrors
(error [self]))
(defprotocol BelongsToDatabase
(idb-database [self]))
(defprotocol IDBKeyRange
(includes [_ k])
(lower [_])
(upper [_])
(lower-open? [_])
(upper-open? [_])
(idb-key-range [_]))
(defprotocol BelongsToSource
(source [self]))
(defprotocol IDBRequest
(result [self])
(ready-state [self]))
(defprotocol BelongsToRequest
(idb-request [self]))
(defprotocol IDBCursor
(direction [self])
(key [self])
(primary-key [self])
(advance [self count])
(continue [self k])
(continue-primary-key [self k primary-key])
(delete [self])
(update [self value]))
(defprotocol IDBCursorWithValue
(value [self]))
(defprotocol ReadableObjectStore
(count [self query])
(key-path [self])
(get [self key])
(get-key [self key])
(get-all [self query count])
(get-all-keys [self query count])
(open-cursor [self query direction])
(open-key-cursor [self query direction]))
(defprotocol IDBObjectStore
(index-names [self])
(auto-increment? [self])
(add [self value key])
(clear [self])
(create-index [self index-name key-path object-parameters])
(delete-item [self k]) ;;; under one polymorphic type?
(delete-index [self index-name])
(index [self index-name])
(put [self item key]))
(defprotocol BelongsToObjectStore
(idb-object-store [self]))
(defprotocol IDBIndex
(auto-locale? [self])
(locale [self])
(multi-entry? [self])
(unique? [self]))
(defprotocol IDBTransaction
(durability [self])
(mode [self])
(object-store [self name])
(abort [self])
(commit [self]))
(defprotocol BelongsToTransaction
(idb-transaction [self]))
(defprotocol IDBVersionChangeEvent
(new-version [self])
(old-version [self]))
(defprotocol EventTarget
(target [self]))