IndexedDB.idl (7906B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: Indexed Database API 3.0 (https://w3c.github.io/IndexedDB/) 5 6 [Exposed=(Window,Worker)] 7 interface IDBRequest : EventTarget { 8 readonly attribute any result; 9 readonly attribute DOMException? error; 10 readonly attribute (IDBObjectStore or IDBIndex or IDBCursor)? source; 11 readonly attribute IDBTransaction? transaction; 12 readonly attribute IDBRequestReadyState readyState; 13 14 // Event handlers: 15 attribute EventHandler onsuccess; 16 attribute EventHandler onerror; 17 }; 18 19 enum IDBRequestReadyState { 20 "pending", 21 "done" 22 }; 23 24 [Exposed=(Window,Worker)] 25 interface IDBOpenDBRequest : IDBRequest { 26 // Event handlers: 27 attribute EventHandler onblocked; 28 attribute EventHandler onupgradeneeded; 29 }; 30 31 [Exposed=(Window,Worker)] 32 interface IDBVersionChangeEvent : Event { 33 constructor(DOMString type, optional IDBVersionChangeEventInit eventInitDict = {}); 34 readonly attribute unsigned long long oldVersion; 35 readonly attribute unsigned long long? newVersion; 36 }; 37 38 dictionary IDBVersionChangeEventInit : EventInit { 39 unsigned long long oldVersion = 0; 40 unsigned long long? newVersion = null; 41 }; 42 43 partial interface mixin WindowOrWorkerGlobalScope { 44 [SameObject] readonly attribute IDBFactory indexedDB; 45 }; 46 47 [Exposed=(Window,Worker)] 48 interface IDBFactory { 49 [NewObject] IDBOpenDBRequest open(DOMString name, 50 optional [EnforceRange] unsigned long long version); 51 [NewObject] IDBOpenDBRequest deleteDatabase(DOMString name); 52 53 Promise<sequence<IDBDatabaseInfo>> databases(); 54 55 short cmp(any first, any second); 56 }; 57 58 dictionary IDBDatabaseInfo { 59 DOMString name; 60 unsigned long long version; 61 }; 62 63 [Exposed=(Window,Worker)] 64 interface IDBDatabase : EventTarget { 65 readonly attribute DOMString name; 66 readonly attribute unsigned long long version; 67 readonly attribute DOMStringList objectStoreNames; 68 69 [NewObject] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames, 70 optional IDBTransactionMode mode = "readonly", 71 optional IDBTransactionOptions options = {}); 72 undefined close(); 73 74 [NewObject] IDBObjectStore createObjectStore( 75 DOMString name, 76 optional IDBObjectStoreParameters options = {}); 77 undefined deleteObjectStore(DOMString name); 78 79 // Event handlers: 80 attribute EventHandler onabort; 81 attribute EventHandler onclose; 82 attribute EventHandler onerror; 83 attribute EventHandler onversionchange; 84 }; 85 86 enum IDBTransactionDurability { "default", "strict", "relaxed" }; 87 88 dictionary IDBTransactionOptions { 89 IDBTransactionDurability durability = "default"; 90 }; 91 92 dictionary IDBObjectStoreParameters { 93 (DOMString or sequence<DOMString>)? keyPath = null; 94 boolean autoIncrement = false; 95 }; 96 97 [Exposed=(Window,Worker)] 98 interface IDBObjectStore { 99 attribute DOMString name; 100 readonly attribute any keyPath; 101 readonly attribute DOMStringList indexNames; 102 [SameObject] readonly attribute IDBTransaction transaction; 103 readonly attribute boolean autoIncrement; 104 105 [NewObject] IDBRequest put(any value, optional any key); 106 [NewObject] IDBRequest add(any value, optional any key); 107 [NewObject] IDBRequest delete(any query); 108 [NewObject] IDBRequest clear(); 109 [NewObject] IDBRequest get(any query); 110 [NewObject] IDBRequest getKey(any query); 111 [NewObject] IDBRequest getAll(optional any queryOrOptions, 112 optional [EnforceRange] unsigned long count); 113 [NewObject] IDBRequest getAllKeys(optional any queryOrOptions, 114 optional [EnforceRange] unsigned long count); 115 [NewObject] IDBRequest getAllRecords(optional IDBGetAllOptions options = {}); 116 [NewObject] IDBRequest count(optional any query); 117 118 [NewObject] IDBRequest openCursor(optional any query, 119 optional IDBCursorDirection direction = "next"); 120 [NewObject] IDBRequest openKeyCursor(optional any query, 121 optional IDBCursorDirection direction = "next"); 122 123 IDBIndex index(DOMString name); 124 125 [NewObject] IDBIndex createIndex(DOMString name, 126 (DOMString or sequence<DOMString>) keyPath, 127 optional IDBIndexParameters options = {}); 128 undefined deleteIndex(DOMString name); 129 }; 130 131 dictionary IDBIndexParameters { 132 boolean unique = false; 133 boolean multiEntry = false; 134 }; 135 136 dictionary IDBGetAllOptions { 137 any query = null; 138 [EnforceRange] unsigned long count; 139 IDBCursorDirection direction = "next"; 140 }; 141 142 [Exposed=(Window,Worker)] 143 interface IDBIndex { 144 attribute DOMString name; 145 [SameObject] readonly attribute IDBObjectStore objectStore; 146 readonly attribute any keyPath; 147 readonly attribute boolean multiEntry; 148 readonly attribute boolean unique; 149 150 [NewObject] IDBRequest get(any query); 151 [NewObject] IDBRequest getKey(any query); 152 [NewObject] IDBRequest getAll(optional any queryOrOptions, 153 optional [EnforceRange] unsigned long count); 154 [NewObject] IDBRequest getAllKeys(optional any queryOrOptions, 155 optional [EnforceRange] unsigned long count); 156 [NewObject] IDBRequest getAllRecords(optional IDBGetAllOptions options = {}); 157 [NewObject] IDBRequest count(optional any query); 158 159 [NewObject] IDBRequest openCursor(optional any query, 160 optional IDBCursorDirection direction = "next"); 161 [NewObject] IDBRequest openKeyCursor(optional any query, 162 optional IDBCursorDirection direction = "next"); 163 }; 164 165 [Exposed=(Window,Worker)] 166 interface IDBKeyRange { 167 readonly attribute any lower; 168 readonly attribute any upper; 169 readonly attribute boolean lowerOpen; 170 readonly attribute boolean upperOpen; 171 172 // Static construction methods: 173 [NewObject] static IDBKeyRange only(any value); 174 [NewObject] static IDBKeyRange lowerBound(any lower, optional boolean open = false); 175 [NewObject] static IDBKeyRange upperBound(any upper, optional boolean open = false); 176 [NewObject] static IDBKeyRange bound(any lower, 177 any upper, 178 optional boolean lowerOpen = false, 179 optional boolean upperOpen = false); 180 181 boolean includes(any key); 182 }; 183 184 [Exposed=(Window,Worker)] 185 interface IDBRecord { 186 readonly attribute any key; 187 readonly attribute any primaryKey; 188 readonly attribute any value; 189 }; 190 191 [Exposed=(Window,Worker)] 192 interface IDBCursor { 193 readonly attribute (IDBObjectStore or IDBIndex) source; 194 readonly attribute IDBCursorDirection direction; 195 readonly attribute any key; 196 readonly attribute any primaryKey; 197 [SameObject] readonly attribute IDBRequest request; 198 199 undefined advance([EnforceRange] unsigned long count); 200 undefined continue(optional any key); 201 undefined continuePrimaryKey(any key, any primaryKey); 202 203 [NewObject] IDBRequest update(any value); 204 [NewObject] IDBRequest delete(); 205 }; 206 207 enum IDBCursorDirection { 208 "next", 209 "nextunique", 210 "prev", 211 "prevunique" 212 }; 213 214 [Exposed=(Window,Worker)] 215 interface IDBCursorWithValue : IDBCursor { 216 readonly attribute any value; 217 }; 218 219 [Exposed=(Window,Worker)] 220 interface IDBTransaction : EventTarget { 221 readonly attribute DOMStringList objectStoreNames; 222 readonly attribute IDBTransactionMode mode; 223 readonly attribute IDBTransactionDurability durability; 224 [SameObject] readonly attribute IDBDatabase db; 225 readonly attribute DOMException? error; 226 227 IDBObjectStore objectStore(DOMString name); 228 undefined commit(); 229 undefined abort(); 230 231 // Event handlers: 232 attribute EventHandler onabort; 233 attribute EventHandler oncomplete; 234 attribute EventHandler onerror; 235 }; 236 237 enum IDBTransactionMode { 238 "readonly", 239 "readwrite", 240 "versionchange" 241 };