mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-28 16:45:10 +08:00
* pouchdb-core fixes. * pouchdb-core fixes. * pouchdb-mapreduce additions. * add semicolons. * Mapreduce fixes from code review. * Add third parameter to Pouchdb.adapter() * Make Pouchdb.adapter() third parameter optional. * Duplicate docs for overloaded functions. * Remove PouchDB.adapter(...) definition.
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
namespace PouchDBBrowserTests {
|
|
function testConstructor() {
|
|
type MyModel = { numericProperty: number };
|
|
let model: PouchDB.Core.Document<MyModel>;
|
|
|
|
let db = new PouchDB<MyModel>('mydb');
|
|
db.viewCleanup().catch((error) => {
|
|
});
|
|
}
|
|
|
|
function testQuery() {
|
|
let pouch = new PouchDB<{}>('mydb');
|
|
// find pokemon with name === 'Pika pi!'
|
|
pouch.query('my_index/by_name', {
|
|
key : 'Pika pi!',
|
|
include_docs : true
|
|
}).then(function (result) {
|
|
// handle result
|
|
}).catch(function (err) {
|
|
// handle errors
|
|
});
|
|
|
|
// find the first 5 pokemon whose name starts with 'P'
|
|
pouch.query('my_index/by_name', {
|
|
startkey : 'P',
|
|
endkey : 'P\uffff',
|
|
limit : 5,
|
|
include_docs : true
|
|
}).then(function (result) {
|
|
// handle result
|
|
}).catch(function (err) {
|
|
// handle errors
|
|
});
|
|
|
|
}
|
|
}
|