Database.hx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated from mozilla\IDBDatabase.webidl. Do not edit!
  23. package js.html.idb;
  24. /**
  25. The `IDBDatabase` interface of the IndexedDB API provides a connection to a database; you can use an `IDBDatabase` object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.
  26. Documentation [IDBDatabase](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) by [Mozilla Contributors](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase$history), licensed under [CC-BY-SA 2.5](https://creativecommons.org/licenses/by-sa/2.5/).
  27. @see <https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase>
  28. **/
  29. @:native("IDBDatabase")
  30. extern class Database extends js.html.EventTarget {
  31. /**
  32. A `DOMString` that contains the name of the connected database.
  33. **/
  34. var name(default,null) : String;
  35. /**
  36. A 64-bit integer that contains the version of the connected database. When a database is first created, this attribute is an empty string.
  37. **/
  38. var version(default,null) : Int;
  39. /**
  40. A `DOMStringList` that contains a list of the names of the object stores currently in the connected database.
  41. **/
  42. var objectStoreNames(default,null) : js.html.DOMStringList;
  43. /**
  44. Fires when access of the database is aborted.
  45. **/
  46. var onabort : haxe.Constraints.Function;
  47. /**
  48. Fires when the `close` event occurs; this happens when the database is unexpectedly closed, such as during application shutdown.
  49. **/
  50. var onclose : haxe.Constraints.Function;
  51. /**
  52. Fires when access to the database fails.
  53. **/
  54. var onerror : haxe.Constraints.Function;
  55. /**
  56. Fires when a database structure change (`IDBOpenDBRequest.onupgradeneeded` event or` ``IDBFactory.deleteDatabase()` was requested elsewhere (most probably in another window/tab on the same computer). This is different from the version change transaction (see `IDBVersionChangeEvent`), but it is related.
  57. **/
  58. var onversionchange : haxe.Constraints.Function;
  59. /**
  60. Creates and returns a new object store or index.
  61. @throws DOMError
  62. **/
  63. function createObjectStore( name : String, ?optionalParameters : ObjectStoreParameters ) : ObjectStore;
  64. /**
  65. Destroys the object store with the given name in the connected database, along with any indexes that reference it.
  66. @throws DOMError
  67. **/
  68. function deleteObjectStore( name : String ) : Void;
  69. /**
  70. Immediately returns a transaction object (`IDBTransaction`) containing the `IDBTransaction.objectStore` method, which you can use to access your object store. Runs in a separate thread.
  71. @throws DOMError
  72. **/
  73. @:overload( function( storeNames : Array<String>, mode : TransactionMode = READONLY) : Transaction {} )
  74. function transaction( storeNames : String, mode : TransactionMode = READONLY ) : Transaction;
  75. /**
  76. Returns immediately and closes the connection to a database in a separate thread.
  77. **/
  78. function close() : Void;
  79. /** @throws DOMError */
  80. function createMutableFile( name : String, ?type : String ) : Request;
  81. }