Skip to content

Releases: dexie/Dexie.js

Dexie v1.5.0

13 Oct 13:44
Compare
Choose a tag to compare

News

This release is the first maintainence release of Dexie v1.x as version v2.0-beta is being developed on the master branch in parallell. Dexie v1.x is being maintained continously in parallell with the development of 2.x on the master-1 branch.

Support for 'unhandledrejection' event

It's incredibly easy to forget catching promises. The HTML standard has evolved to support a global 'unhandledrejection' event to make sure no error goes unseen for the developer. Dexie 1.5 now supports and embraces the use of this event instead of the previous custom Dexie.Promise.on('error', ...).

window.onunhandledrejection = function (event) {
    var reason = event.reason;
    console.warn('Unhandled Promise Rejection: ' + (reason && (reason.stack || reason));
    event.preventDefault(); // Prohibit default handler from logging to console.
};

Works also with window.addEventListener('unhandledrejection', ...);

Works on legacy browsers as well (Tested on IE11, Firefox 45, Edge 13 and Chrome 49).

Search your code for Promise.on('error, Promise.on("error or Promise.on.error to see if you should go over to the standard way instead. I've deprecated Promise.on.error but it will continue to work in 1.x. In 2.0 it's obsolete.

Bugfixes

Build- and deployment tools

  • Upgrading build and transpiler tools
  • Prepared for supporting maintainance releases on 1.x branch while continuing to develop Dexie v2.x.

Deprecations (See https://github.com/dfahlander/Dexie.js/wiki/Deprecations)

  • Transaction.table (will be continously supported in 2.x as well)
  • Transaction.[table] (will be continously supported in 2.x as well)
  • Transaction.tables (will be continously supported in 2.x as well)
  • Transaction.error (will be obsolete in 2.x)
  • Transaction.complete (will be obsolete in 2.x)
  • Dexie.Promise.on('error', ...) (Will be obsolete in 2.x)

Dexie v2.0.0-beta.2

12 Oct 12:13
Compare
Choose a tag to compare
Dexie v2.0.0-beta.2 Pre-release
Pre-release

First beta-release of the 2.0 track.

Support for async functions (native and transpiled)

  • Typescript 2.0 compatible async await within transactions without quirks.
  • Compatible with the native async await in Edge 14 and Chrome 53 (with experimental flags on)
  • Should be compatible witht transpiled async await using babel (not verified yet)
  • Should be compatible with Angular2 and Zone.js when using typescript's transpiled async functions (not verified yet)

No need to 'stick to Dexie.Promise'

Native (or polyfilled) Promise can be safely used within transaction scopes. So for example, the use of Promise.all(...) would break transaction in Dexie v1.x but works perfectly well in Dexie v2.x without having to do Dexie.Promise.all(...). We're solving the browser-issues described in #317 by polyfilling the global Promise to play well with indexedDB transactions within the transaction scope only, and revert the patching for every leave from the transaction scope. This is possible only because of the built-in zone system that Dexie has.

Prepared to retire Dexie.Promise in a future major version

Dexie v2.x will keep using Dexie.Promise, but the work needed retire Dexie.Promise in favour of native Promise has been implemented, and once the problem described in #317 is fully solved widely by the affected browsers (IE, Safari and Firefox) we will do that shift. In the meantime, I've started the mounting down of Dexie.Promise-specific API:s so that the user shouldn't have to think about Dexie.Promise anymore. Code will look the same as soon as we do the switch to native Promise.

Breaking Changes / Backward Compatibility

Dexie 2.0 is built with backward compatibility in mind, but there are a few things that you would might need to fix before migrating:

  1. Dexie.Promise.on('error') is deprecated in Dexie 1.5.0 and obsolete in Dexie 2.0.0. Deprecation notes
  2. db.on('error') is deprecated in Dexie 1.5.0 and obsolete in Dexie 2.0.0. Deprecation notes

A full story of obsolete parts of the API is listed in the wiki under Deprecations. Note that some of the deprecations are still available in 2.0 but are planned to go obsolete in 3.0.

The main reason for the major version increment, else than the obsolete methods, is the new way that db.transaction() works - specifically that it patches the global promise within the transaction zone, wich is a change of a behavior in an existing API. db.transaction() is still backward compatible though and you don't need to change your transaction code.

Dexie v1.5.0-rc.2

12 Oct 11:21
Compare
Choose a tag to compare
Dexie v1.5.0-rc.2 Pre-release
Pre-release

Deprecating Promise.on.error and added support for the global unhandledrejection event. Subscribe to the unhandledrejection event instead. This is the standard way of catching unhandled native promise rejections as well.

Dexie v1.5.0-rc

11 Oct 13:49
Compare
Choose a tag to compare
Dexie v1.5.0-rc Pre-release
Pre-release

Minor version was incremented due to deprecation of APIs (see notes below). Note that those API:s still work and most of them will continue to work also in Dexie 2.x.

Bugfixes:

  • Fixes #326 Broken sourceMappingURL for dexie.min.js

Build- and deployment tools

  • Upgrading build and transpiler tools
  • Prepared for supporting maintainance releases on 1.x branch while continuing to develop Dexie v2.x.
  • Avoiding cyclic dependencies in ES6 source

Deprecations (See https://github.com/dfahlander/Dexie.js/wiki/Deprecations)

  • Transaction.table (will be continously supported in 2.x as well)
  • Transaction.[table](will be continously supported in 2.x as well)
  • Transaction.tables (will be continously supported in 2.x as well)
  • Transaction.error (will be obsolete in 2.x)
  • Transaction.complete (will be obsolete in 2.x)

Dexie v1.4.3-rc

21 Sep 10:14
Compare
Choose a tag to compare
Dexie v1.4.3-rc Pre-release
Pre-release

Resolved issues:

  • Issue with '?' transaction mode c9e1384
  • #310 Problems including dexie using rollup 8e1beff

Also:

  • Replace npmcdn.com with unpkg.com 5fe9c3a

Dexie v1.4.2

06 Sep 13:55
Compare
Choose a tag to compare
  • Resolves Issue #306 db.on('ready') behaves differently in 1.4.1 than in 1.3.6.
  • DB upgrading: Delete table if no content upgrader has run. 1c19f39 ( by @chrahunt )
  • DB upgrading: Fix test for db table deletion. 2154dd3 ( by @chrahunt )
  • d.ts fixes by @phiresky: 9db18e4. 786ca0b
  • README updates
  • Fixed Travid build to allow travis-local testing instead of browserstack for pull requests.

Dexie v1.4.1

07 Jun 22:48
Compare
Choose a tag to compare

Fixes issue #264

Dexie v1.4.0

07 Jun 15:25
Compare
Choose a tag to compare

Optimized, simplified and debug friendlier.

Much of the code base has been rewritten since v1.3.6 for the purposes of both optimization and code simplification.

Async stacks for Easier Debugging

  • Async stack support on all thrown errors in debug mode.
  • Debug mode is defined via Dexie.debug static property.
  • Dexie.debug will default to true when served from localhost.
Dexie.debug = true; // Enables long stacks (Default on when served from localhost)

db.friends.toArray(friends => {
    return friends.map(friend => friend.name);
}).then (names => {
    console.log(names.join(', ');
}).then (()=> {
    throw new Error ("oops!");
}).catch (function (e) {
    console.error ("Oops: " + e.stack); // Will see long stacks containing async flow:
         // Error: oops!
         //    at yourSource:file:line
         // From previous:
         //    at yourSource of prevous promise
         //    ...
         // From previous:
         //    at yourSrouce even earlier...
         //    ...
});

Reusable Collections

If you prepare a collection:

var collection = db.friends.where('age').above(25);

...you can reuse that collection in any transaction later:

db.transaction('r', db.friends, function() {
    collection.toArray(function (result) {
        console.log(JSON.stringify(result));
    });
});

In previous versions, Collections where bound to the transaction where they were created.

Optimizations

  • Using new indexedDB methods getAll() & getAllKeys when available in IDBObjectStore & IDBIndex.
  • Faster promise implementation. Chaining .then() on returned promises will execute in a virtual micro-tick engine which ensures maximum performance as well as keeping indexedDB transactions alive no matter how long you chains are. Previous version did also keep indexedDB transaction alive, but executed then-handlers in a long and clumsy stack, which failed to comply fully with the A+ spec and made it cumbersome to debug and could theoretically end up in a stack overflow if utilizing very long promise chains.
  • No leaking arguments enables V8 to optimize more code.
  • No dynamic properties on Transaction objects.
  • Fewer layers when accessing a transaction.

Totally Rewritten Promise

The Promise class has been rewritten totally in order to be more optimized and execute all tasks in a virtual indexedDB-compliant microtick engine.

Cleaner Code

Dexie.js and its other modules has been revised and some complex methods has been simplified.

Architectural Changes

  • db.transaction() will now always execute the scope function asynchronically. In previous versions, the scope function could be executed either directly (synchronically) or asynchronically depending on whether the database was ready, or if a parent transaction was locked.
  • Table instances are singletons of WriteableTable now. There's no more need to dynamically generate Table instances when creating a transaction instance because the Table methods will inspect ongoing transaction runtime instead. A future major release (2.0) will likely deprecate WriteableTable and instead incorporate it into class Table, as with WriteableCollection to be incorporated into Collection. Table related properties on Transaction is subject of deprecation as well, since it's returned instances aren't bound to the transaction.

Other

See also pull request #242 which contains most of the changes in this release.

Known Issues

  • Open issues
  • Specifically, this version will trigger this zonejs issue when used together with karma-source-map-support. This is not a Dexie issue, but since Dexie v1.4.0 performs a feature detection by calling new Error().stack at startup, it will fail there if karma-source-map-support and zone.js are loaded.

Dexie v1.4.0-rc.1

31 May 13:11
Compare
Choose a tag to compare
Dexie v1.4.0-rc.1 Pre-release
Pre-release

Probably the final pre-relase for 1.4.0. No new bugfixes or features added since the last beta. Just some build- and test improvements.

This rc was built using node 6 instead of node 4 that was used earlier.

Dexie v1.4.0-beta.3

10 May 13:05
Compare
Choose a tag to compare
Dexie v1.4.0-beta.3 Pre-release
Pre-release

Fixed issue #248: 'modifications' object in 'updating' hook can be bizarre.

To install this pre-release from npm, use:

npm install dexie@next

or if you want to be more specific:

npm install dexie@1.4.0-beta.3