Skip to content

Commit 176249d

Browse files
committed
Merge pull request DefinitelyTyped#1512 from joeriks/master
Updated for current PouchDB api
2 parents f687f7b + 70d47a5 commit 176249d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

pouchDB/pouch-tests.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/// <reference path="pouch.d.ts" />
22

3-
declare var $: any;
4-
5-
window.alert = function(thing?: string) {
6-
$('body').append('<div>' + thing + '</div>');
3+
window.alert = function (thing?: string) {
4+
var div = document.createElement('div');
5+
div.appendChild(document.createTextNode(thing));
6+
document.getElementsByTagName('body')[0].appendChild(div);
77
}
88

9-
var pouch: Pouch;
9+
var pouch: PouchDB;
1010

1111
function pouchTests() {
12-
Pouch('idb://testdb', function (err: PouchError, res: Pouch) {
12+
PouchDB('testdb', function (err: PouchError, res: PouchDB) {
1313
if (err) {
1414
alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
1515
}
@@ -130,7 +130,7 @@ function deleteDb() {
130130
alert('deleteDb');
131131
if (pouch) {
132132
pouch = null;
133-
Pouch.destroy('idb://testdb', function (err: PouchError) {
133+
PouchDB.destroy('testdb', function (err: PouchError) {
134134
if (err) {
135135
alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason);
136136
}

pouchDB/pouch.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,14 @@ interface PouchOptions {
209209
adapter?: string;
210210
}
211211

212-
interface Pouch extends PouchApi {
213-
(name: string, opts: PouchOptions, callback: (err: PouchError, res: Pouch) => void ): Pouch;
214-
(name: string, callback: (err: PouchError, res: Pouch) => void ): Pouch;
212+
interface PouchDB extends PouchApi {
213+
new (name: string, opts: PouchOptions, callback: (err: PouchError, res: PouchDB) => void): PouchDB;
214+
new (name: string, callback: (err: PouchError, res: PouchDB) => void): PouchDB;
215+
new (name: string): PouchDB;
215216
destroy(name: string, callback: (err: PouchError) => void): void;
216217
}
217218

218-
declare var Pouch: Pouch;
219+
declare var PouchDB: PouchDB;
219220
//
220221
// emit is the function that the PouchFilter.map function should call in order to add a particular item to
221222
// a filter view.

0 commit comments

Comments
 (0)