Database.hx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (C)2005-2018 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. /**
  33. A `DOMString` that contains the name of the connected database.
  34. **/
  35. var name(default,null) : String;
  36. /**
  37. A 64-bit integer that contains the version of the connected database. When a database is first created, this attribute is an empty string.
  38. **/
  39. var version(default,null) : Int;
  40. /**
  41. A `DOMStringList` that contains a list of the names of the object stores currently in the connected database.
  42. **/
  43. var objectStoreNames(default,null) : js.html.DOMStringList;
  44. /**
  45. Fires when access of the database is aborted.
  46. **/
  47. var onabort : haxe.Constraints.Function;
  48. /**
  49. Fires when the `close` event occurs; this happens when the database is unexpectedly closed, such as during application shutdown.
  50. **/
  51. var onclose : haxe.Constraints.Function;
  52. /**
  53. Fires when access to the database fails.
  54. **/
  55. var onerror : haxe.Constraints.Function;
  56. /**
  57. 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.
  58. **/
  59. var onversionchange : haxe.Constraints.Function;
  60. /**
  61. Creates and returns a new object store or index.
  62. @throws DOMError
  63. **/
  64. function createObjectStore( name : String, ?optionalParameters : ObjectStoreParameters ) : ObjectStore;
  65. /**
  66. Destroys the object store with the given name in the connected database, along with any indexes that reference it.
  67. @throws DOMError
  68. **/
  69. function deleteObjectStore( name : String ) : Void;
  70. /**
  71. 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.
  72. @throws DOMError
  73. **/
  74. @:overload( function( storeNames : Array<String>, ?mode : TransactionMode = "readonly") : Transaction {} )
  75. function transaction( storeNames : String, ?mode : TransactionMode = "readonly" ) : Transaction;
  76. /**
  77. Returns immediately and closes the connection to a database in a separate thread.
  78. **/
  79. function close() : Void;
  80. /** @throws DOMError */
  81. function createMutableFile( name : String, ?type : String ) : Request;
  82. }