Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof partialsThreshold === 'number') {
// Don't allow NaN or negative threshold
if (isNaN(partialsThreshold) || partialsThreshold < 0) {
throw new Error('The given number for the threshold is not supported');
}
// If the threshold is 0 we will not send any client changes but will get server changes
} else {
// Use Infinity as the default so simple protocols don't have to care about partial synchronization
protocolInstance.partialsThreshold = Infinity;
}
Syncable.registeredProtocols[name] = protocolInstance;
};
// Register addon in Dexie:
Dexie.Syncable = Syncable;
Dexie.addons.push(Syncable);
};
Syncable.registeredProtocols = {}; // Map when key is the provider name.
Syncable.registerSyncProtocol = function(name, protocolInstance) {
/// <summary>
/// Register a syncronization protocol that can syncronize databases with remote servers.
/// </summary>
/// Provider name
/// Implementation of ISyncProtocol
Syncable.registeredProtocols[name] = protocolInstance;
};
// Register addon in Dexie:
Dexie.Syncable = Syncable;
Dexie.addons.push(Syncable);
Observable._onBeforeUnload = function() {
Observable.on.beforeunload.fire();
};
Observable.localStorageImpl = global.localStorage;
//
// Map window events to static events in Dexie.Observable:
//
if (global.addEventListener) {
global.addEventListener("storage", Observable._onStorage);
global.addEventListener("beforeunload", Observable._onBeforeUnload);
}
// Register addon:
Dexie.Observable = Observable;
Dexie.addons.push(Observable);
value.then(onSuccess, onError));
}
}
function awaitAll (values, i) {
if (i === values.length) return onSuccess(values);
var value = values[i];
return value.constructor && typeof value.constructor.all == 'function' ?
value.constructor.all(values).then(onSuccess, onError) :
awaitAll (values, i + 1);
}
return step(callNext)();
}
Dexie.addons.push(function (db) {
//
// Adjust db.transaction() to handle iterable functions as async without explicitely having to write async() around the transaction scope func:
// db.transaction('rw', db.friends, async(function*(){})); - not needed.
// db.transaction('rw', db.friends, function*(){}); // prettier.
//
db.transaction = Dexie.override(db.transaction, function (origDbTransaction) {
return function () {
var scopeFunc = arguments[arguments.length - 1];
function proxyScope() {
var rv = scopeFunc.apply(this, arguments);
if (!rv.next || !rv.throw) return rv; // Not an iterable
return iterate(rv);
}
proxyScope.toString =
Observable._onBeforeUnload = function () {
Observable.on.beforeunload.fire();
};
Observable.localStorageImpl = global.localStorage;
//
// Map window events to static events in Dexie.Observable:
//
if (global.addEventListener) {
global.addEventListener("storage", Observable._onStorage);
global.addEventListener("beforeunload", Observable._onBeforeUnload);
}
// Register addon:
Dexie.Observable = Observable;
Dexie.addons.push(Observable);
export default Observable;
//# sourceMappingURL=dexie-observable.es6.js.map
Observable._onBeforeUnload = function() {
Observable.on.beforeunload.fire();
};
Observable.localStorageImpl = global.localStorage;
//
// Map window events to static events in Dexie.Observable:
//
if (global.addEventListener) {
global.addEventListener("storage", Observable._onStorage);
global.addEventListener("beforeunload", Observable._onBeforeUnload);
}
// Register addon:
Dexie.Observable = Observable;
Dexie.addons.push(Observable);