Debian Codegraph @

externs/w3c_indexeddb.js

raw symbols SCIP
1 /*
2 * Copyright 2011 The Closure Compiler Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /**
18 * @fileoverview Definitions for W3C's IndexedDB API. In Chrome all the
19 * IndexedDB classes are prefixed with 'webkit'. In order to access constants
20 * and static methods of these classes they must be duplicated with the
21 * prefix here.
22 * @see http://www.w3.org/TR/IndexedDB/
23 *
24 * @externs
25 * @author [email protected] (Guido Tapia)
26 */
27
28 /** @type {IDBFactory} */
29 Window.prototype.moz_indexedDB;
30
31 /** @type {IDBFactory} */
32 Window.prototype.mozIndexedDB;
33
34 /** @type {IDBFactory} */
35 Window.prototype.webkitIndexedDB;
36
37 /** @type {IDBFactory} */
38 Window.prototype.msIndexedDB;
39
40 /** @type {IDBFactory} */
41 Window.prototype.indexedDB;
42
43 /**
44 * @constructor
45 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBFactory
46 */
47 function IDBFactory() {}
48
49 /**
50 * @param {string} name The name of the database to open.
51 * @param {number=} opt_version The version at which to open the database.
52 * @return {!IDBOpenDBRequest} The IDBRequest object.
53 */
54 IDBFactory.prototype.open = function(name, opt_version) {};
55
56 /**
57 * @param {string} name The name of the database to delete.
58 * @return {!IDBOpenDBRequest} The IDBRequest object.
59 */
60 IDBFactory.prototype.deleteDatabase = function(name) {};
61
62 /**
63 * @constructor
64 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabaseException
65 */
66 function IDBDatabaseException() {}
67
68 /**
69 * @constructor
70 * @extends {IDBDatabaseException}
71 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabaseException
72 */
73 function webkitIDBDatabaseException() {}
74
75 /**
76 * @const
77 * @type {number}
78 */
79 IDBDatabaseException.UNKNOWN_ERR;
80
81 /**
82 * @const
83 * @type {number}
84 */
85 webkitIDBDatabaseException.UNKNOWN_ERR;
86
87 /**
88 * @const
89 * @type {number}
90 */
91 IDBDatabaseException.NON_TRANSIENT_ERR;
92
93 /**
94 * @const
95 * @type {number}
96 */
97 webkitIDBDatabaseException.NON_TRANSIENT_ERR;
98
99 /**
100 * @const
101 * @type {number}
102 */
103 IDBDatabaseException.NOT_FOUND_ERR;
104
105 /**
106 * @const
107 * @type {number}
108 */
109 webkitIDBDatabaseException.NOT_FOUND_ERR;
110
111 /**
112 * @const
113 * @type {number}
114 */
115 IDBDatabaseException.CONSTRAINT_ERR;
116
117 /**
118 * @const
119 * @type {number}
120 */
121 webkitIDBDatabaseException.CONSTRAINT_ERR;
122
123 /**
124 * @const
125 * @type {number}
126 */
127 IDBDatabaseException.DATA_ERR;
128
129 /**
130 * @const
131 * @type {number}
132 */
133 webkitIDBDatabaseException.DATA_ERR;
134
135 /**
136 * @const
137 * @type {number}
138 */
139 IDBDatabaseException.NOT_ALLOWED_ERR;
140
141 /**
142 * @const
143 * @type {number}
144 */
145 webkitIDBDatabaseException.NOT_ALLOWED_ERR;
146
147 /**
148 * @const
149 * @type {number}
150 */
151 IDBDatabaseException.TRANSACTION_INACTIVE_ERR;
152
153 /**
154 * @const
155 * @type {number}
156 */
157 webkitIDBDatabaseException.TRANSACTION_INACTIVE_ERR;
158
159 /**
160 * @const
161 * @type {number}
162 */
163 IDBDatabaseException.ABORT_ERR;
164
165 /**
166 * @const
167 * @type {number}
168 */
169 webkitIDBDatabaseException.ABORT_ERR;
170
171 /**
172 * @const
173 * @type {number}
174 */
175 IDBDatabaseException.READ_ONLY_ERR;
176
177 /**
178 * @const
179 * @type {number}
180 */
181 webkitIDBDatabaseException.READ_ONLY_ERR;
182
183 /**
184 * @const
185 * @type {number}
186 */
187 IDBDatabaseException.TIMEOUT_ERR;
188
189 /**
190 * @const
191 * @type {number}
192 */
193 webkitIDBDatabaseException.TIMEOUT_ERR;
194
195 /**
196 * @const
197 * @type {number}
198 */
199 IDBDatabaseException.QUOTA_ERR;
200
201 /**
202 * @const
203 * @type {number}
204 */
205 webkitIDBDatabaseException.QUOTA_ERR;
206
207 /**
208 * @const
209 * @type {number}
210 */
211 IDBDatabaseException.code;
212
213 /**
214 * @const
215 * @type {number}
216 */
217 webkitIDBDatabaseException.code;
218
219 /**
220 * @const
221 * @type {string}
222 */
223 IDBDatabaseException.message;
224
225 /**
226 * @const
227 * @type {string}
228 */
229 webkitIDBDatabaseException.message;
230
231 /** @type {function(new:IDBRequest)} */
232 Window.prototype.IDBRequest;
233
234 /** @type {function(new:IDBRequest)} */
235 Window.prototype.webkitIDBRequest;
236
237 /**
238 * @constructor
239 * @implements {EventTarget}
240 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBRequest
241 */
242 function IDBRequest() {}
243
244 /** @override */
245 IDBRequest.prototype.addEventListener = function(type, listener, useCapture) {};
246
247 /** @override */
248 IDBRequest.prototype.removeEventListener =
249 function(type, listener, useCapture) {};
250
251 /** @override */
252 IDBRequest.prototype.dispatchEvent = function(evt) {};
253
254 /**
255 * @constructor
256 * @extends {IDBRequest}
257 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBRequest
258 */
259 function webkitIDBRequest() {}
260
261 /**
262 * @type {number}
263 * @const
264 */
265 IDBRequest.LOADING;
266
267 /**
268 * @type {number}
269 * @const
270 */
271 webkitIDBRequest.LOADING;
272
273 /**
274 * @type {number}
275 * @const
276 */
277 IDBRequest.DONE;
278
279 /**
280 * @type {number}
281 * @const
282 */
283 webkitIDBRequest.DONE;
284
285 /**
286 * @type {number}
287 * @const
288 */
289 IDBRequest.prototype.readyState;
290
291 /**
292 * @type {function(!Event)}
293 */
294 IDBRequest.prototype.onsuccess = function(e) {};
295
296 /**
297 * @type {function(!Event)}
298 */
299 IDBRequest.prototype.onerror = function(e) {};
300
301 /**
302 * @type {*}
303 * @const
304 */
305 IDBRequest.prototype.result;
306
307 /**
308 * @type {number}
309 * @const
310 */
311 IDBRequest.prototype.errorCode;
312
313 /**
314 * @type {Object}
315 * @const
316 */
317 IDBRequest.prototype.source;
318
319 /**
320 * @type {IDBTransaction}
321 * @const
322 */
323 IDBRequest.prototype.transaction;
324
325 /** @type {function(new:IDBOpenDBRequest)} */
326 Window.prototype.IDBOpenDBRequest;
327
328 /**
329 * @constructor
330 * @extends {IDBRequest}
331 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBOpenDBRequest
332 */
333 function IDBOpenDBRequest() {}
334
335 /**
336 * @type {function(!IDBVersionChangeEvent)}
337 */
338 IDBOpenDBRequest.prototype.onblocked = function(e) {};
339
340 /**
341 * @type {function(!IDBVersionChangeEvent)}
342 */
343 IDBOpenDBRequest.prototype.onupgradeneeded = function(e) {};
344
345 /**
346 * @constructor
347 * @implements {EventTarget}
348 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBDatabase
349 */
350 function IDBDatabase() {}
351
352 /**
353 * @type {string}
354 * @const
355 */
356 IDBDatabase.prototype.name;
357
358 /**
359 * @type {string}
360 * @const
361 */
362 IDBDatabase.prototype.description;
363
364 /**
365 * @type {string}
366 * @const
367 */
368 IDBDatabase.prototype.version;
369
370 /**
371 * @type {DOMStringList}
372 * @const
373 */
374 IDBDatabase.prototype.objectStoreNames;
375
376 /**
377 * @param {string} name The name of the object store.
378 * @param {Object=} opt_parameters Parameters to be passed
379 * creating the object store.
380 * @return {!IDBObjectStore} The created/open object store.
381 */
382 IDBDatabase.prototype.createObjectStore =
383 function(name, opt_parameters) {};
384
385 /**
386 * @param {string} name The name of the object store to remove.
387 */
388 IDBDatabase.prototype.deleteObjectStore = function(name) {};
389
390 /**
391 * @param {string} version The new version of the database.
392 * @return {!IDBRequest} The IDBRequest object.
393 */
394 IDBDatabase.prototype.setVersion = function(version) {};
395
396 /**
397 * @param {Array.<string>} storeNames The stores to open in this transaction.
398 * @param {(number|string)=} mode The mode for opening the object stores.
399 * @return {!IDBTransaction} The IDBRequest object.
400 */
401 IDBDatabase.prototype.transaction = function(storeNames, mode) {};
402
403 /**
404 * Closes the database connection.
405 */
406 IDBDatabase.prototype.close = function() {};
407
408 /**
409 * @type {Function}
410 */
411 IDBDatabase.prototype.onabort = function() {};
412
413 /**
414 * @type {Function}
415 */
416 IDBDatabase.prototype.onerror = function() {};
417
418 /**
419 * @type {Function}
420 */
421 IDBDatabase.prototype.onversionchange = function() {};
422
423 /** @override */
424 IDBDatabase.prototype.addEventListener =
425 function(type, listener, useCapture) {};
426
427 /** @override */
428 IDBDatabase.prototype.removeEventListener =
429 function(type, listener, useCapture) {};
430
431 /** @override */
432 IDBDatabase.prototype.dispatchEvent = function(evt) {};
433
434 /**
435 * Typedef for valid key types according to the w3 specification. Note that this
436 * is slightly wider than what is actually allowed, as all Array elements must
437 * have a valid key type.
438 * @see http://www.w3.org/TR/IndexedDB/#key-construct
439 * @typedef {number|string|!Date|!Array}
440 */
441 var IDBKeyType;
442
443 /**
444 * @constructor
445 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBObjectStore
446 */
447 function IDBObjectStore() {}
448
449 /**
450 * @type {string}
451 */
452 IDBObjectStore.prototype.name;
453
454 /**
455 * @type {string}
456 */
457 IDBObjectStore.prototype.keyPath;
458
459 /**
460 * @type {DOMStringList}
461 */
462 IDBObjectStore.prototype.indexNames;
463
464 /** @type {IDBTransaction} */
465 IDBObjectStore.prototype.transaction;
466
467 /** @type {boolean} */
468 IDBObjectStore.prototype.autoIncrement;
469
470 /**
471 * @param {*} value The value to put into the object store.
472 * @param {IDBKeyType=} key The key of this value.
473 * @return {!IDBRequest} The IDBRequest object.
474 */
475 IDBObjectStore.prototype.put = function(value, key) {};
476
477 /**
478 * @param {*} value The value to add into the object store.
479 * @param {IDBKeyType=} key The key of this value.
480 * @return {!IDBRequest} The IDBRequest object.
481 */
482 IDBObjectStore.prototype.add = function(value, key) {};
483
484 /**
485 * @param {IDBKeyType} key The key of this value.
486 * @return {!IDBRequest} The IDBRequest object.
487 */
488 IDBObjectStore.prototype['delete'] = function(key) {};
489
490 /**
491 * @param {IDBKeyType} key The key of the document to retrieve.
492 * @return {!IDBRequest} The IDBRequest object.
493 */
494 IDBObjectStore.prototype.get = function(key) {};
495
496 /**
497 * @return {!IDBRequest} The IDBRequest object.
498 */
499 IDBObjectStore.prototype.clear = function() {};
500
501 /**
502 * @param {IDBKeyRange=} range The range of the cursor.
503 * @param {(number|string)=} direction The direction of cursor enumeration.
504 * @return {!IDBRequest} The IDBRequest object.
505 */
506 IDBObjectStore.prototype.openCursor = function(range, direction) {};
507
508 /**
509 * @param {string} name The name of the index.
510 * @param {string} keyPath The path to the index key.
511 * @param {Object=} opt_paramters Optional parameters
512 * for the created index.
513 * @return {!IDBIndex} The IDBIndex object.
514 */
515 IDBObjectStore.prototype.createIndex = function(name, keyPath, opt_paramters) {};
516
517 /**
518 * @param {string} name The name of the index to retrieve.
519 * @return {!IDBIndex} The IDBIndex object.
520 */
521 IDBObjectStore.prototype.index = function(name) {};
522
523 /**
524 * @param {string} indexName The name of the index to remove.
525 */
526 IDBObjectStore.prototype.deleteIndex = function(indexName) {};
527
528 /**
529 * @param {IDBKeyType=} key The key of this value.
530 * @return {!IDBRequest} The IDBRequest object.
531 */
532 IDBObjectStore.prototype.count = function(key) {};
533
534 /**
535 * @constructor
536 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBIndex
537 */
538 function IDBIndex() {}
539
540 /**
541 * @type {string}
542 * @const
543 */
544 IDBIndex.prototype.name;
545
546 /**
547 * @type {!IDBObjectStore}
548 * @const
549 */
550 IDBIndex.prototype.objectStore;
551
552 /**
553 * @type {string}
554 * @const
555 */
556 IDBIndex.prototype.keyPath;
557
558 /**
559 * @type {boolean}
560 * @const
561 */
562 IDBIndex.prototype.unique;
563
564 /**
565 * @param {IDBKeyRange=} range The range of the cursor.
566 * @param {(number|string)=} direction The direction of cursor enumeration.
567 * @return {!IDBRequest} The IDBRequest object.
568 */
569 IDBIndex.prototype.openCursor = function(range, direction) {};
570
571 /**
572 * @param {IDBKeyRange=} range The range of the cursor.
573 * @param {(number|string)=} direction The direction of cursor enumeration.
574 * @return {!IDBRequest} The IDBRequest object.
575 */
576 IDBIndex.prototype.openKeyCursor = function(range, direction) {};
577
578 /**
579 * @param {IDBKeyType} key The id of the object to retrieve.
580 * @return {!IDBRequest} The IDBRequest object.
581 */
582 IDBIndex.prototype.get = function(key) {};
583
584 /**
585 * @param {IDBKeyType} key The id of the object to retrieve.
586 * @return {!IDBRequest} The IDBRequest object.
587 */
588 IDBIndex.prototype.getKey = function(key) {};
589
590 /** @type {function(new:IDBCursor)} */
591 Window.prototype.IDBCursor;
592
593 /** @type {function(new:IDBCursor)} */
594 Window.prototype.webkitIDBCursor;
595
596 /**
597 * @constructor
598 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBCursor
599 */
600 function IDBCursor() {}
601
602 /**
603 * @constructor
604 * @extends {IDBCursor}
605 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBCursor
606 */
607 function webkitIDBCursor() {}
608
609 /**
610 * @const
611 * @type {number}
612 */
613 IDBCursor.NEXT;
614
615 /**
616 * @const
617 * @type {number}
618 */
619 webkitIDBCursor.NEXT;
620
621 /**
622 * @const
623 * @type {number}
624 */
625 IDBCursor.NEXT_NO_DUPLICATE;
626
627 /**
628 * @const
629 * @type {number}
630 */
631 webkitIDBCursor.NEXT_NO_DUPLICATE;
632
633 /**
634 * @const
635 * @type {number}
636 */
637 IDBCursor.PREV;
638
639 /**
640 * @const
641 * @type {number}
642 */
643 webkitIDBCursor.PREV;
644
645 /**
646 * @const
647 * @type {number}
648 */
649 IDBCursor.PREV_NO_DUPLICATE;
650
651 /**
652 * @const
653 * @type {number}
654 */
655 webkitIDBCursor.PREV_NO_DUPLICATE;
656
657 /**
658 * @type {*}
659 * @const
660 */
661 IDBCursor.prototype.source;
662
663 /**
664 * @type {number}
665 * @const
666 */
667 IDBCursor.prototype.direction;
668
669 /**
670 * @type {IDBKeyType}
671 * @const
672 */
673 IDBCursor.prototype.key;
674
675 /**
676 * @type {number}
677 * @const
678 */
679 IDBCursor.prototype.primaryKey;
680
681 /**
682 * @param {*} value The new value for the current object in the cursor.
683 * @return {!IDBRequest} The IDBRequest object.
684 */
685 IDBCursor.prototype.update = function(value) {};
686
687 /**
688 * Note: Must be quoted to avoid parse error.
689 * @param {IDBKeyType=} key Continue enumerating the cursor from the specified
690 * key (or next).
691 */
692 IDBCursor.prototype['continue'] = function(key) {};
693
694 /**
695 * @param {number} count Number of times to iterate the cursor.
696 */
697 IDBCursor.prototype.advance = function(count) {};
698
699 /**
700 * Note: Must be quoted to avoid parse error.
701 * @return {!IDBRequest} The IDBRequest object.
702 */
703 IDBCursor.prototype['delete'] = function() {};
704
705 /** @type {function(new:IDBTransaction)} */
706 Window.prototype.IDBTransaction;
707
708 /** @type {function(new:IDBTransaction)} */
709 Window.prototype.webkitIDBTransaction;
710
711 /**
712 * @constructor
713 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBTransaction
714 */
715 function IDBTransaction() {}
716
717 /**
718 * @constructor
719 * @extends {IDBTransaction}
720 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBTransaction
721 */
722 function webkitIDBTransaction() {}
723
724 /**
725 * @const
726 * @type {number}
727 */
728 IDBTransaction.READ_WRITE;
729
730 /**
731 * @const
732 * @type {number}
733 */
734 webkitIDBTransaction.READ_WRITE;
735
736 /**
737 * @const
738 * @type {number}
739 */
740 IDBTransaction.READ_ONLY;
741
742 /**
743 * @const
744 * @type {number}
745 */
746 webkitIDBTransaction.READ_ONLY;
747
748 /**
749 * @const
750 * @type {number}
751 */
752 IDBTransaction.VERSION_CHANGE;
753
754 /**
755 * @const
756 * @type {number}
757 */
758 webkitIDBTransaction.VERSION_CHANGE;
759
760 /**
761 * @type {number|string}
762 * @const
763 */
764 IDBTransaction.prototype.mode;
765
766 /**
767 * @type {IDBDatabase}
768 * @const
769 */
770 IDBTransaction.prototype.db;
771
772 /**
773 * @param {string} name The name of the object store to retrieve.
774 * @return {!IDBObjectStore} The object store.
775 */
776 IDBTransaction.prototype.objectStore = function(name) {};
777
778 /**
779 * Aborts the transaction.
780 */
781 IDBTransaction.prototype.abort = function() {};
782
783 /**
784 * @type {Function}
785 */
786 IDBTransaction.prototype.onabort = function() {};
787
788 /**
789 * @type {Function}
790 */
791 IDBTransaction.prototype.oncomplete = function() {};
792
793 /**
794 * @type {Function}
795 */
796 IDBTransaction.prototype.onerror = function() {};
797
798 /** @type {function(new:IDBKeyRange)} */
799 Window.prototype.IDBKeyRange;
800
801 /** @type {function(new:IDBKeyRange)} */
802 Window.prototype.webkitIDBKeyRange;
803
804 /**
805 * @constructor
806 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBKeyRange
807 */
808 function IDBKeyRange() {}
809
810 /**
811 * @constructor
812 * @extends {IDBKeyRange}
813 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBKeyRange
814 */
815 function webkitIDBKeyRange() {}
816
817 /**
818 * @type {*}
819 * @const
820 */
821 IDBKeyRange.prototype.lower;
822
823 /**
824 * @type {*}
825 * @const
826 */
827 IDBKeyRange.prototype.upper;
828
829 /**
830 * @type {*}
831 * @const
832 */
833 IDBKeyRange.prototype.lowerOpen;
834
835 /**
836 * @type {*}
837 * @const
838 */
839 IDBKeyRange.prototype.upperOpen;
840
841 /**
842 * @param {IDBKeyType} value The single key value of this range.
843 * @return {!IDBKeyRange} The key range.
844 */
845 IDBKeyRange.only = function(value) {};
846
847 /**
848 * @param {IDBKeyType} value The single key value of this range.
849 * @return {!IDBKeyRange} The key range.
850 */
851 webkitIDBKeyRange.only = function(value) {};
852
853 /**
854 * @param {IDBKeyType} bound Creates a lower bound key range.
855 * @param {boolean=} open Open the key range.
856 * @return {!IDBKeyRange} The key range.
857 */
858 IDBKeyRange.lowerBound = function(bound, open) {};
859
860 /**
861 * @param {IDBKeyType} bound Creates a lower bound key range.
862 * @param {boolean=} open Open the key range.
863 * @return {!IDBKeyRange} The key range.
864 */
865 webkitIDBKeyRange.lowerBound = function(bound, open) {};
866
867 /**
868 * @param {IDBKeyType} bound Creates an upper bound key range.
869 * @param {boolean=} open Open the key range.
870 * @return {!IDBKeyRange} The key range.
871 */
872 IDBKeyRange.upperBound = function(bound, open) {};
873
874 /**
875 * @param {IDBKeyType} bound Creates an upper bound key range.
876 * @param {boolean=} open Open the key range.
877 * @return {!IDBKeyRange} The key range.
878 */
879 webkitIDBKeyRange.upperBound = function(bound, open) {};
880
881 /**
882 * @param {IDBKeyType} left The left bound value.
883 * @param {IDBKeyType} right The right bound value.
884 * @param {boolean=} openLeft Whether the left bound value should be excluded.
885 * @param {boolean=} openRight Whether the right bound value should be excluded.
886 * @return {!IDBKeyRange} The key range.
887 */
888 IDBKeyRange.bound = function(left, right, openLeft, openRight) {};
889
890 /**
891 * @param {IDBKeyType} left The left bound value.
892 * @param {IDBKeyType} right The right bound value.
893 * @param {boolean=} openLeft Whether the left bound value should be excluded.
894 * @param {boolean=} openRight Whether the right bound value should be excluded.
895 * @return {!IDBKeyRange} The key range.
896 */
897 webkitIDBKeyRange.bound = function(left, right, openLeft, openRight) {};
898
899 /**
900 * @constructor
901 * @extends {Event}
902 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBVersionChangeEvent
903 */
904 function IDBVersionChangeEvent() {}
905
906 /**
907 * @type {number}
908 * @const
909 */
910 IDBVersionChangeEvent.prototype.oldVersion;
911
912 /**
913 * @type {?number}
914 * @const
915 */
916 IDBVersionChangeEvent.prototype.newVersion;
917
918 /**
919 * @constructor
920 * @extends {IDBVersionChangeEvent}
921 * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBVersionChangeEvent
922 */
923 function webkitIDBVersionChangeEvent() {}
924
925 /**
926 * @type {string}
927 * @const
928 */
929 webkitIDBVersionChangeEvent.prototype.version;