Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

websql

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websql - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

lib/custom.js

34

lib/index.js
'use strict';
var sqlite3 = require('sqlite3');
var immediate = require('immediate');
var argsarray = require('argsarray');
var noop = require('noop-fn');
var customOpenDatabase = require('./custom');
var WebSQLDatabase = require('./WebSQLDatabase');
function createDb(dbName, dbVersion) {
var sqliteDatabase = new sqlite3.Database(dbName);
return new WebSQLDatabase(dbVersion, sqliteDatabase);
}
function openDatabase(args) {
if (args.length < 4) {
throw new Error('Failed to execute \'openDatabase\': ' +
'4 arguments required, but only ' + args.length + ' present');
}
var dbName = args[0];
var dbVersion = args[1];
// db description and size are ignored
var callback = args[4] || noop;
var db = createDb(dbName, dbVersion);
immediate(function () {
callback(db);
});
return db;
}
module.exports = argsarray(openDatabase);
module.exports = customOpenDatabase(sqlite3);

@@ -11,3 +11,3 @@ 'use strict';

function onTransactionComplete(err) {
self._db.run('END TRANSACTION;', function () {
self._db.run('END TRANSACTION;', [], function () {
self._running = false;

@@ -14,0 +14,0 @@

{
"name": "websql",
"version": "0.1.0",
"version": "0.2.0",
"description": "WebSQL Database API, implemented for Node using sqlite3",

@@ -5,0 +5,0 @@ "repository": {

@@ -1,5 +0,5 @@

node-websql [![Build Status](https://travis-ci.org/nolanlawson/node-websql.svg?branch=master)](https://travis-ci.org/nolanlawson/node-websql) [![Coverage Status](https://coveralls.io/repos/github/nolanlawson/node-websql/badge.svg?branch=master)](https://coveralls.io/github/nolanlawson/node-websql?branch=master)
node-websql [![Build Status](https://travis-ci.org/nolanlawson/node-websql.svg?branch=master)](https://travis-ci.org/nolanlawson/node-websql) [![Coverage Status](https://coveralls.io/repos/github/nolanlawson/node-websql/badge.svg?branch=master&nonce=foo)](https://coveralls.io/github/nolanlawson/node-websql?branch=master)
====
The [Web SQL Database API][websql], implemented for Node
The [WebSQL Database API][websql], implemented for Node
using [sqlite3](https://github.com/mapbox/node-sqlite3).

@@ -43,3 +43,3 @@

The `callback` just returns the same database object returned
The `callback` just returns the same database object returned
synchronously (_migrations currently aren't supported - see below_).

@@ -52,6 +52,19 @@

### Custom sqlite3 implementation
If you'd like to use your own `sqlite3` implementation, just do:
```js
var customOpenDatabase = require('websql/custom');
var openDatabase = customOpenDatabase(mySqlite3);
```
Your responsibility as a developer is to implement the subset of the
`sqlite3` API which this module uses. At this time, that means the `db.all()`
and `db.run()` methods. See the [sqlite3 docs](https://github.com/mapbox/node-sqlite3) for more info.
Goals
----
The [Web SQL Database API][websql] is a deprecated
The [WebSQL Database API][websql] is a deprecated
standard, but in many cases it's useful to reuse legacy code

@@ -83,4 +96,4 @@ designed for browsers that support WebSQL. Also, it allows you to quickly

The versioning and migration APIs
(i.e. [`changeVersion()`](https://www.w3.org/TR/webdatabase/#dom-database-changeversion))
The versioning and migration APIs
(i.e. [`changeVersion()`](https://www.w3.org/TR/webdatabase/#dom-database-changeversion))
are not supported. Pull requests welcome!

@@ -110,3 +123,3 @@

npm run test-local
Run the actual-WebSQL test against PhantomJS:

@@ -113,0 +126,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc