forked from dougnukem/hello-atom
-
Notifications
You must be signed in to change notification settings - Fork 24
/
script.js
50 lines (34 loc) · 1.21 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(function () {
'use strict';
var $ = document.querySelector.bind(document);
// IndexedDB
var db = new PouchDB('mydb-idb');
db.info().then(function (info) {
$('#idb').innerHTML = '✔ We can use PouchDB with IndexedDB!';
}).catch(function (err) {
$('#idb').innerHTML = 'Error for IndexedDB';
});
// WebSQL
var websqlDB = new PouchDB('mydb-websql', {adapter: 'websql'});
websqlDB.info().then(function (info) {
$('#websql').innerHTML = '✔ We can use PouchDB with WebSQL!';
}).catch(function (err) {
$('#websql').innerHTML = 'Error for WebSQL';
});
// LevelDB
var NodePouchDB = require('pouchdb');
var leveldbDB = new NodePouchDB('mydb-leveldb');
leveldbDB.info().then(function (info) {
$('#leveldb').innerHTML = '✔ We can use PouchDB with LevelDB!';
}).catch(function (err) {
$('#leveldb').innerHTML = 'Error for LevelDB';
});
// node-websql
NodePouchDB.plugin(require('pouchdb-adapter-node-websql'));
var sqliteDB = new NodePouchDB('mydb-sqlite', {adapter: 'websql'});
sqliteDB.info().then(function (info) {
$('#sqlitedb').innerHTML = '✔ We can use PouchDB with node-websql (SQLite)!';
}).catch(function (err) {
$('#sqlitedb').innerHTML = 'Error for node-websql (SQLite)';
});
})();