本文整理汇总了TypeScript中pouchdb.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resolve
partialsDB.destroy().then(function(){
let partialsDB=PouchDB(partialsdb+'_'+data.uid+'_year',{auto_compaction: true});
delete yearPower._rev
partialsDB.put(yearPower).then(function(){
resolve(true);
}).catch(function(err){
reject(err);
});
});
示例2: constructor
constructor(path) {
var Pouch = require('pouchdb');
//Pouch.debug.enable('*');
Pouch.plugin(require('geopouch'));
this.db = Pouch(path, {
});
this.fs = require('level-filesystem')(this.db);
}
示例3: initDB
private initDB() { this.db = PouchDB('estado', { adapter: 'websql' }); }
示例4: Promise
return new Promise(function (resolve, reject) {
let localDB=PouchDB(localdb);
let partialsDB=PouchDB(partialsdb+'_'+data.uid+'_year',{auto_compaction: true});
let dateDay=parseInt(data.date[6]+data.date[7]);
let dateMonth=parseInt(data.date[4]+data.date[5]);
let dateforYear=parseInt(data.date[0]+data.date[1]+data.date[2]+data.date[3]);
let dateBeginningOfDay=moment.tz(dateforYear+' '+dateMonth+' '+dateDay,"YYYY MM DD",timezone).valueOf();
let dateBeginningOfMonth=moment.tz(dateforYear+' '+dateMonth+' 01',"YYYY MM DD",timezone).valueOf();
let dateBeginningOfYear=moment.tz(dateforYear+' 01 01',"YYYY MM DD",timezone).valueOf();
let dateforDay=parseInt(dateforYear+data.date[4]+data.date[5]+dateDay);
let dateforMonth=parseInt(dateforYear+data.date[4]+data.date[5]);
partialsDB.get('yearly_'+data.uid).then(function(yearPower){
if( yearPower.dateBeginningOfYear != dateBeginningOfYear ){
let yearlynew={
_id:'yearly_'+data.uid+'_'+yearPower.dateforYear,
power:yearPower.power,
updatedAt:yearPower.dateBeginningOfYear
};
localDB.put(yearlynew).then(function(doc){
yearPower.power=data.yearlyEnergy;
yearPower.dateBeginningOfYear=dateBeginningOfYear;
yearPower.dateforYear=dateforYear;
partialsDB.destroy().then(function(){
let partialsDB=PouchDB(partialsdb+'_'+data.uid+'_year',{auto_compaction: true});
delete yearPower._rev
partialsDB.put(yearPower).then(function(){
resolve(true);
}).catch(function(err){
reject(err);
});
});
}).catch(function(err){
reject(err);
});
} else{
yearPower.power=data.yearlyEnergy;
yearPower.dateBeginningOfYear=dateBeginningOfYear;
yearPower.dateforYear=dateforYear;
partialsDB.destroy().then(function(){
let partialsDB=PouchDB(partialsdb+'_'+data.uid+'_year',{auto_compaction: true});
delete yearPower._rev
partialsDB.put(yearPower).then(function(){
resolve(true);
}).catch(function(err){
reject(err);
});
});
}
}).catch(function(){
let yearly={
_id:'yearly_'+data.uid,
dateBeginningOfYear:dateBeginningOfYear,
power:data.yearlyEnergy,
dateforYear:dateforYear
};
partialsDB.put(yearly).then(function(){
resolve(true);
}).catch(function(err){
reject(err);
});
});
})
示例5: initDB
private initDB() { this.db = PouchDB('perfiles', { adapter: 'websql' }) }