當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript pouchdb.default函數代碼示例

本文整理匯總了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);
            });
  });
開發者ID:dottgonzo,項目名稱:express-autoaurora,代碼行數:11,代碼來源:setpowerpartials.ts

示例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);

    }
開發者ID:automenta,項目名稱:netjs3,代碼行數:15,代碼來源:db.ts

示例3: initDB

 private initDB() { this.db = PouchDB('estado', { adapter: 'websql' }); }
開發者ID:sclMAX,項目名稱:INDUMATICS,代碼行數:1,代碼來源:estados.ts

示例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);
          });
        });




})
開發者ID:dottgonzo,項目名稱:express-autoaurora,代碼行數:94,代碼來源:setpowerpartials.ts

示例5: initDB

 private initDB() { this.db = PouchDB('perfiles', { adapter: 'websql' }) }
開發者ID:sclMAX,項目名稱:INDUMATICS,代碼行數:1,代碼來源:perfiles.ts


注:本文中的pouchdb.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。