Skip to content

Commit

Permalink
Build outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
dfahlander committed Mar 6, 2016
1 parent c988353 commit 1678e35
Show file tree
Hide file tree
Showing 10 changed files with 3,315 additions and 3,133 deletions.
38 changes: 29 additions & 9 deletions addons/dexie-yield/dist/dexie-yield.es6.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@

import Dexie from 'dexie';

import Dexie from 'dexie';

// Prefer standard promise, but fallback to Dexie Promise.
// The standard Promise will only be used in case the async function throws or returns value before yielding a thenable.
// If writing the async functions correctly, async() will adapt to the type of promise returned, such as Q, WinJS or Dexie.

var Promise = (typeof self === 'undefined' ? global : (self || window)).Promise || Dexie.Promise;

export function async(generatorFn) {
return function () {
return iterate(generatorFn.apply(this, arguments));
try {
var rv = iterate(generatorFn.apply(this, arguments));
if (!rv || typeof rv.then !== 'function')
return Promise.resolve(rv);
return rv;
} catch (e) {
return Promise.reject(e);
}
}
}

export function spawn(generatorFn, promiseImpl) {
return iterate(generatorFn());
export function spawn(generatorFn, args, thiz) {
try {
var rv = iterate(generatorFn.apply(thiz, args || []));
if (!rv || typeof rv.then !== 'function')
return Dexie.Promise.resolve(rv);
return rv;
} catch (e) {
return Dexie.Promise.reject(e);
}
}

export function iterate (iterable) {
Expand All @@ -34,7 +54,7 @@ export function iterate (iterable) {
var value = values[i];
return value.constructor && typeof value.constructor.all == 'function' ?
value.constructor.all(values).then(onSuccess, onError) :
awaitAll (values, i + 1);
awaitAll (values, i + 1);
}

return step(callNext)();
Expand All @@ -56,9 +76,9 @@ Dexie.addons.push(function (db) {
return iterate(rv);
}

proxyScope.toString = function () {
return scopeFunc.toString(); // Because original db.transaction may use fn.toString() when error occur.
}
proxyScope.toString =
() => scopeFunc.toString(); // Because original db.transaction may use fn.toString() when error occur.
arguments[arguments.length - 1] = proxyScope;
return origDbTransaction.apply(this, arguments);
}
Expand Down
34 changes: 27 additions & 7 deletions addons/dexie-yield/dist/dexie-yield.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion addons/dexie-yield/dist/dexie-yield.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1678e35

Please sign in to comment.