本文整理匯總了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' }) }