blocked

  • Revision slug: DOM/Mozilla_event_reference/blocked_indexedDB
  • Revision title: blocked
  • Revision id: 366747
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment Moved From Mozilla_event_reference/blocked_indexedDB to DOM/Mozilla_event_reference/blocked_indexedDB

Revision Content

The blocked handler is executed when an open connection to a database is blocking a versionchange transaction on the same database.

General info

Specification
IndexedDB
Interface
IDBVersionChangeEvent
Bubbles
No
Cancelable
No
Target
IDBRequest
Default Action
None

Properties

{{OpenEventProperties("The request concerned by this event")}}{{IDBVersionChangeEventProperties()}}{{CloseEventProperties()}}

Example

var req1 = indexedDB.open("addressbook", 3);
 
req1.onsuccess = function( event ) {
  var addressbookDB = event.target.result;
  
  // Let's try to open the same database with a higher revision version
  var req2 = indexedDB.open("addressbook", 4);
  
  // In this case the onblocked handler will be executed
  req2.onblocked = function( e ) {
    console.log(e)
  };
 
};

{{IDBRelatedEvents()}}

See also

Revision Source

<p>The <code>blocked</code> handler is executed when an open connection to a database is blocking a <code>versionchange</code> transaction on the same database.</p>
<h2 id="General_info">General info</h2>
<dl>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Specification</dt>
  <dd style="margin: 0 0 0 120px;">
    <a class="external" href="http://www.w3.org/TR/IndexedDB/#request-api">IndexedDB</a></dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Interface</dt>
  <dd style="margin: 0 0 0 120px;">
    IDBVersionChangeEvent</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Bubbles</dt>
  <dd style="margin: 0 0 0 120px;">
    No</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Cancelable</dt>
  <dd style="margin: 0 0 0 120px;">
    No</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Target</dt>
  <dd style="margin: 0 0 0 120px;">
    IDBRequest</dd>
  <dt style="clear: left; float: left; text-align: right; width: 120px;">
    Default Action</dt>
  <dd style="margin: 0 0 0 120px;">
    None</dd>
</dl>
<h2 id="Properties">Properties</h2>
<p>{{OpenEventProperties("The request concerned by this event")}}{{IDBVersionChangeEventProperties()}}{{CloseEventProperties()}}</p>
<h2 id="Example">Example</h2>
<pre class="brush:js;">
var req1 = indexedDB.open("addressbook", 3);
 
req1.onsuccess = function( event ) {
  var addressbookDB = event.target.result;
  
  // Let's try to open the same database with a higher revision version
  var req2 = indexedDB.open("addressbook", 4);
  
  // In this case the onblocked handler will be executed
  req2.onblocked = function( e ) {
    console.log(e)
  };
 
};

</pre>
<h2 id="Related_Events">Related Events</h2>
<p>{{IDBRelatedEvents()}}</p>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/IndexedDB/Using_IndexedDB">Using IndexedDB</a></li>
</ul>
Revert to this revision