each method using callback

In the previous version, the "each" method returns a promise returning the cursor. With the cursor, you can perform operations like continue or advance. However, the "onsuccess" property of the cursor can't be changed.

The "each" method receives this onsuccess method and resolves the promise, passing the cursor. The problem is that promises can't and shouldn't be resolved more than once, so it's impossible to access the cursor after the first element.

The submitted change allows to pass a callback to the each function. This way, we use the each in the more usual way, receiving a callback that will receive the objects. This callback could receive the value itself, but I rather pass it the cursor, so it can perform operations such advance(). 

It makes no sense to use the promise to pass the cursor anymore, so I decided to use it to notify the end of the cursor. A sample code would work as follow:

```javascript
store.each(function(cursor){
  value = cursor.value;
  //Do whatever you want with value
  cursor.continue();
}).then(function(){
  console.log("Cursor end reached")
});
```

If you want to advance in the cursor, to jump to a certain item or page, you can do as follow:

```javascript
var init = true;
store.each(function(cursor){
  if (init)
  {
    init = false;
    cursor.advance(page*elements_by_page);
    return;
  }
  value = cursor.value;
  //Do whatever you want with value
  cursor.continue();
}).then(function(){
  console.log("Cursor end reached")
});
```