- From: Michaël Rouges <michael.rouges@gmail.com>
- Date: Mon, 22 Apr 2013 18:43:13 +0200
- To: public-webapps@w3.org
- Message-ID: <CAMNVKQE+675ZFTYehHA2dw2nJL5juvzOwwfx4yWPdU+bya470w@mail.gmail.com>
Hello everyone, I'm surprised by how events are added to IndexedDB objects. For example, base, opening a database: var request; request = indexedDB.open('database'); request.onsuccess = function () {}; request.onupgradeneeded = function () {}; request.onerror = function () {}; As you can see, the events are added after the query execution. It does not seem natural and can cause stability problems. Indeed, if the application had to be completed by the addition of events, they will never be triggered. Here is an example generates an error: var request; request = indexedDB.open('database'); setTimeout(function () { request.onsuccess = function () {}; request.onupgradeneeded = function () {}; request.onerror = function () {}; }, 1500); In my view, any item requiring events should be set first, then we add the events and finally, we execute it. The code should look like this: var request; request = indexedDB.open('database'); request.onsuccess = function () {}; request.onupgradeneeded = function () {}; request.onerror = function () {}; request.execute(); For additional information and / or feedback, do not hesitate to contact me. ;)
Received on Monday, 22 April 2013 16:43:42 UTC