mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 22:38:16 +08:00
Merge pull request #1512 from joeriks/master
Updated for current PouchDB api
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
/// <reference path="pouch.d.ts" />
|
||||
|
||||
declare var $: any;
|
||||
|
||||
window.alert = function(thing?: string) {
|
||||
$('body').append('<div>' + thing + '</div>');
|
||||
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);
|
||||
}
|
||||
|
||||
9
pouchDB/pouch.d.ts
vendored
9
pouchDB/pouch.d.ts
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user