diff --git a/pouchDB/pouch-tests.ts b/pouchDB/pouch-tests.ts index 8cca2ed710..5534ca3672 100644 --- a/pouchDB/pouch-tests.ts +++ b/pouchDB/pouch-tests.ts @@ -1,15 +1,15 @@ /// -declare var $: any; - -window.alert = function(thing?: string) { - $('body').append('
' + thing + '
'); +window.alert = function (thing?: string) { + var div = document.createElement('div'); + div.appendChild(document.createTextNode(thing)); + document.getElementsByTagName('body')[0].appendChild(div); } -var pouch: Pouch; +var pouch: PouchDB; function pouchTests() { - Pouch('idb://testdb', function (err: PouchError, res: Pouch) { + PouchDB('testdb', function (err: PouchError, res: PouchDB) { if (err) { alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason); } @@ -130,7 +130,7 @@ function deleteDb() { alert('deleteDb'); if (pouch) { pouch = null; - Pouch.destroy('idb://testdb', function (err: PouchError) { + PouchDB.destroy('testdb', function (err: PouchError) { if (err) { alert('Error ' + err.status + ' occurred ' + err.error + ' - ' + err.reason); } diff --git a/pouchDB/pouch.d.ts b/pouchDB/pouch.d.ts index 661c7b686b..47ffcad606 100644 --- a/pouchDB/pouch.d.ts +++ b/pouchDB/pouch.d.ts @@ -209,13 +209,14 @@ interface PouchOptions { adapter?: string; } -interface Pouch extends PouchApi { - (name: string, opts: PouchOptions, callback: (err: PouchError, res: Pouch) => void ): Pouch; - (name: string, callback: (err: PouchError, res: Pouch) => void ): Pouch; +interface PouchDB extends PouchApi { + new (name: string, opts: PouchOptions, callback: (err: PouchError, res: PouchDB) => void): PouchDB; + new (name: string, callback: (err: PouchError, res: PouchDB) => void): PouchDB; + new (name: string): PouchDB; destroy(name: string, callback: (err: PouchError) => void): void; } -declare var Pouch: Pouch; +declare var PouchDB: PouchDB; // // emit is the function that the PouchFilter.map function should call in order to add a particular item to // a filter view.