diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/api/idbfactory | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/api/idbfactory')
-rw-r--r-- | files/pt-br/web/api/idbfactory/index.html | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/files/pt-br/web/api/idbfactory/index.html b/files/pt-br/web/api/idbfactory/index.html new file mode 100644 index 0000000000..e422763fd2 --- /dev/null +++ b/files/pt-br/web/api/idbfactory/index.html @@ -0,0 +1,210 @@ +--- +title: IDBFactory +slug: Web/API/IDBFactory +translation_of: Web/API/IDBFactory +--- +<p>{{APIRef("IndexedDB")}}</p> + +<div> +<p>A interface IDBFactory, pertencente a <a href="/en-US/docs/IndexedDB">IndexedDB API</a> , permite que aplicativos acessem de forma assíncrona os bancos de dados indexados. O objeto que implementa a interface é o window.indexedDB, com este objeto é possível criar, acessar, modificar e excluir informações de um banco de dados. </p> + +<p>{{AvailableInWorkers}}</p> +</div> + +<h2 id="Métodos">Métodos</h2> + +<dl> + <dt>{{domxref("IDBFactory.open")}}</dt> + <dd>Realizar a abertura de uma <a href="https://developer.mozilla.org/en-US/docs/IndexedDB#gloss_database_connection">conexão com uma base de dados</a>.</dd> + <dt>{{domxref("IDBFactory.deleteDatabase")}}</dt> + <dd>Remove uma base de dados.</dd> + <dt>{{domxref("IDBFactory.cmp")}}</dt> + <dd>Compara dois valores chaves e determina se elas são iguais e se não, quem é a maior.</dd> +</dl> + +<h3 id="Métodos_Obsoletos">Métodos Obsoletos</h3> + +<dl> + <dt><code><a href="/en-US/docs/Web/API/IDBFactory.open-obsolete">IDBFactory.open</a></code>, a versão original {{ obsolete_inline }}</dt> + <dd>Este método realizava <a href="https://developer.mozilla.org/en-US/docs/IndexedDB#gloss_database_connection">conexão com uma base de dados</a>, ele ainda é usado em alguns navegadores.</dd> +</dl> + +<h2 id="Exemplo">Exemplo</h2> + +<p>No código abaixo, realizamos uma conexão com um banco de dados e incluímos manipuladores para os casos de sucesso e erro. Você pode obter o <a class="external" href="https://github.com/mdn/to-do-notifications/tree/gh-pages">To-do Notifications</a> app como exemplo (<a class="external" href="http://mdn.github.io/to-do-notifications/">Visualizar exemplo</a>.)</p> + +<pre class="brush:js;highlight:[10]">var note = document.querySelector("ul"); + +// In the following line, you should include the prefixes of implementations you want to test. +window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; +// DON'T use "var indexedDB = ..." if you're not in a function. +// Moreover, you may need references to some window.IDB* objects: +window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction; +window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; +// (Mozilla has never prefixed these objects, so we don't need window.mozIDB*) + +// Let us open version 4 of our database +var DBOpenRequest = window.indexedDB.open("toDoList", 4); + +// these two event handlers act on the database being opened successfully, or not +DBOpenRequest.onerror = function(event) { + note.innerHTML += '<li>Error loading database.</li>'; +}; + +DBOpenRequest.onsuccess = function(event) { + note.innerHTML += '<li>Database initialised.</li>'; + + // store the result of opening the database in the db variable. This is used a lot later on, for opening transactions and suchlike. + db = DBOpenRequest.result; +}; +</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('IndexedDB', '#idl-def-IDBFactory', 'IDBFactory')}}</td> + <td>{{Spec2('IndexedDB')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName("IndexedDB 2", "#factory-interface", "IDBFactory")}}</td> + <td>{{Spec2("IndexedDB 2")}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(23)}} {{property_prefix("webkit")}}<br> + {{CompatChrome(24)}} (unprefixed)<br> + {{CompatChrome(38)}} (prefixes deprecated)<br> + {{CompatChrome(57)}} (prefixes removed)</td> + <td>{{CompatVersionUnknown}}</td> + <td>10 {{property_prefix("moz")}}<br> + {{CompatGeckoDesktop("16.0")}}</td> + <td>10, partial</td> + <td>15<br> + {{CompatOpera(44)}} (prefixes removed)</td> + <td>7.1</td> + </tr> + <tr> + <td>Available in workers</td> + <td>{{CompatVersionUnknown}} (unprefixed)<br> + {{CompatChrome(38)}} (prefixes deprecated)<br> + {{CompatChrome(57)}} (prefixes removed)</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("37.0")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}<br> + {{CompatOpera(44)}} (prefixes removed)</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td>Indexed Database 2.0</td> + <td>{{CompatChrome(58)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatOpera(45)}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android Webview</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}<br> + {{CompatChrome(38)}} (prefixes deprecated)<br> + {{CompatChrome(57)}} (prefixes removed)</td> + <td>{{CompatVersionUnknown}}<br> + {{CompatChrome(38)}} (prefixes deprecated)<br> + {{CompatChrome(57)}} (prefixes removed)</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("22.0")}}</td> + <td>1.0.1</td> + <td>10</td> + <td>22<br> + {{CompatOperaMobile(44)}} (prefixes removed)</td> + <td>8</td> + </tr> + <tr> + <td>Available in workers</td> + <td>{{CompatVersionUnknown}} (unprefixed)<br> + {{CompatChrome(38)}} (prefixes deprecated)<br> + {{CompatChrome(57)}} (prefixes removed)</td> + <td>{{CompatVersionUnknown}} (unprefixed)<br> + {{CompatChrome(38)}} (prefixes deprecated)<br> + {{CompatChrome(57)}} (prefixes removed)</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("37.0")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}<br> + {{CompatOperaMobile(44)}} (prefixes removed)</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td>Indexed Database 2.0</td> + <td>{{CompatChrome(58)}}</td> + <td>{{CompatChrome(58)}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatOperaMobile(45)}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB">Usando IndexedDB</a></li> + <li>Inicializando uma Transaction: {{domxref("IDBDatabase")}}</li> + <li>Usando uma Transaction: {{domxref("IDBTransaction")}}</li> + <li>Configurando um Intervalo de chaves: {{domxref("IDBKeyRange")}}</li> + <li>Recuperando e modificando dados: {{domxref("IDBObjectStore")}}</li> + <li>Usando cursors: {{domxref("IDBCursor")}}</li> + <li>Exemplo de referência: <a class="external" href="https://github.com/mdn/to-do-notifications/tree/gh-pages">To-do Notifications</a> (<a class="external" href="http://mdn.github.io/to-do-notifications/">Visualizar exemplo</a>.)</li> +</ul> |