pouchdb-adapter-websql
Advanced tools
Comparing version
@@ -71,16 +71,26 @@ 'use strict'; | ||
function websql(optsOrName, version, description, size) { | ||
if (typeof sqlitePlugin !== 'undefined') { | ||
// The SQLite Plugin started deviating pretty heavily from the | ||
// standard openDatabase() function, as they started adding more features. | ||
// It's better to just use their "new" format and pass in a big ol' | ||
// options object. | ||
return sqlitePlugin.openDatabase(optsOrName); | ||
} | ||
function createOpenDBFunction(opts) { | ||
return function (name, version, description, size) { | ||
if (typeof sqlitePlugin !== 'undefined') { | ||
// The SQLite Plugin started deviating pretty heavily from the | ||
// standard openDatabase() function, as they started adding more features. | ||
// It's better to just use their "new" format and pass in a big ol' | ||
// options object. Also there are many options here that may come from | ||
// the PouchDB constructor, so we have to grab those. | ||
var sqlitePluginOpts = jsExtend.extend({}, opts, { | ||
name: name, | ||
version: version, | ||
description: description, | ||
size: size | ||
}); | ||
return sqlitePlugin.openDatabase(sqlitePluginOpts); | ||
} | ||
// Traditional WebSQL API | ||
return openDatabase(optsOrName, version, description, size); | ||
// Traditional WebSQL API | ||
return openDatabase(name, version, description, size); | ||
}; | ||
} | ||
function WebSQLPouch(opts, callback) { | ||
var websql = createOpenDBFunction(opts); | ||
var _opts = jsExtend.extend({ | ||
@@ -87,0 +97,0 @@ websql: websql |
{ | ||
"name": "pouchdb-adapter-websql", | ||
"version": "5.4.0", | ||
"version": "5.4.1", | ||
"description": "PouchDB adapter using WebSQL as its data store.", | ||
@@ -17,5 +17,5 @@ "main": "./lib/index.js", | ||
"js-extend": "1.0.1", | ||
"pouchdb-adapter-websql-core": "5.4.0", | ||
"pouchdb-utils": "5.4.0" | ||
"pouchdb-adapter-websql-core": "5.4.1", | ||
"pouchdb-utils": "5.4.1" | ||
} | ||
} |
@@ -5,16 +5,26 @@ import WebSqlPouchCore from 'pouchdb-adapter-websql-core'; | ||
function websql(optsOrName, version, description, size) { | ||
if (typeof sqlitePlugin !== 'undefined') { | ||
// The SQLite Plugin started deviating pretty heavily from the | ||
// standard openDatabase() function, as they started adding more features. | ||
// It's better to just use their "new" format and pass in a big ol' | ||
// options object. | ||
return sqlitePlugin.openDatabase(optsOrName); | ||
} | ||
function createOpenDBFunction(opts) { | ||
return function (name, version, description, size) { | ||
if (typeof sqlitePlugin !== 'undefined') { | ||
// The SQLite Plugin started deviating pretty heavily from the | ||
// standard openDatabase() function, as they started adding more features. | ||
// It's better to just use their "new" format and pass in a big ol' | ||
// options object. Also there are many options here that may come from | ||
// the PouchDB constructor, so we have to grab those. | ||
var sqlitePluginOpts = extend({}, opts, { | ||
name: name, | ||
version: version, | ||
description: description, | ||
size: size | ||
}); | ||
return sqlitePlugin.openDatabase(sqlitePluginOpts); | ||
} | ||
// Traditional WebSQL API | ||
return openDatabase(optsOrName, version, description, size); | ||
// Traditional WebSQL API | ||
return openDatabase(name, version, description, size); | ||
}; | ||
} | ||
function WebSQLPouch(opts, callback) { | ||
var websql = createOpenDBFunction(opts); | ||
var _opts = extend({ | ||
@@ -21,0 +31,0 @@ websql: websql |
19902
3.91%190
11.76%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated