当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Storage.set方法代码示例

本文整理汇总了TypeScript中@ionic/storage.Storage.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Storage.set方法的具体用法?TypeScript Storage.set怎么用?TypeScript Storage.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ionic/storage.Storage的用法示例。


在下文中一共展示了Storage.set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: async

              this.http.get<IModuleConfig[]>(jsonPath).subscribe( async (jsonConfigList:IModuleConfig[]) => {
                const appUpdateStorage = await this.storage.get("appUpdateAvailable");
                for (let config of configList) {
                  if (localConfig.id == config.id) {

                    let configToSave = config;
                    for (let jsonConfig of jsonConfigList) {
                      if (jsonConfig.id == config.id) {
                        if (appUpdateStorage != config.appVersion) {
                          // check for new appVersion and notify user if new update is available
                          if (jsonConfig.appVersion) {
                            if (config.appVersion > jsonConfig.appVersion) {
                              this.storage.set("appUpdateAvailable", true);
                            } else if (jsonConfig.appVersion > config.appVersion) {
                              this.storage.set("appUpdateAvailable", jsonConfig.appVersion);
                              configToSave = jsonConfig;
                            }
                          } else { this.storage.set("appUpdateAvailable", true); }
                        } else if (jsonConfig.appVersion > config.appVersion) {
                          configToSave = jsonConfig;
                        }
                      }
                    }

                    // store up-to-date config in storage
                    this.storage.set("config", configToSave);
                    this.initPush(configToSave);
                    break;

                  }
                }
              });
开发者ID:University-of-Potsdam-MM,项目名称:ReflectUP,代码行数:32,代码来源:app.component.ts

示例2:

   storage.get('dbVersion').then((val) => {
     if(!(val instanceof UniversityListVersion))
       val = {index: 0};
     let dbObj:Container = universityService.getUniversities(val);
     this.universities = dbObj.dbList;
     storage.set('dbList', dbObj.dbList );
     storage.set('dbVersion', dbObj.dbVersion );
 })
开发者ID:ppoggi,项目名称:OwlApp,代码行数:8,代码来源:home.ts

示例3:

 return Observable.create(observer => {
   this.currentUser = null;
   this.currentToken = null;
   this.storage.set('currentToken', null);
   this.storage.set('currentUser', null);
   observer.next(true);
   observer.complete();
 });
开发者ID:50Hannah000,项目名称:MDB1,代码行数:8,代码来源:authentication.ts

示例4: constructor

  constructor(public storage: Storage, public navCtrl: NavController, public navParams: NavParams, public auth:Auth,) {

      this.storage.set('email', null);
      this.storage.set('password', null);
      this.fireAuth = firebase.auth();
	  	this.auth.logout();
	    this.navCtrl.setRoot(LoginPage);
  }
开发者ID:gianmichelesiano,项目名称:Bandigare,代码行数:8,代码来源:logout.ts

示例5: saveUiid

  saveUiid(uuid: string) {

    if(this.device.uuid != null) {
      this.storage.set('uuid', uuid);
    } else {
      this.storage.set('uuid', Guid.create());
    }

    return true;
  }
开发者ID:jctovar,项目名称:iztacala,代码行数:10,代码来源:device.ts

示例6:

 return this.get(key).then((val)=>{
  let id = value['id'];
  if(val === null){
   let initObj = {};
   initObj[id] = value;
   return this.storage.set(key, JSON.stringify(initObj));
  }
  let addObj = JSON.parse(val);
  addObj[id] = value;
  return this.storage.set(key, JSON.stringify(addObj));
 });
开发者ID:Beethovenw,项目名称:Elastos.ORG.Wallet.Mobile,代码行数:11,代码来源:Localstorage.ts

示例7: Observable

 let ob = new Observable(observer2 => {
   this.storage
     .set('geochronUsername', username)
     .then(success => observer2.next(1), error => observer2.next(1));
   this.storage
     .set('geochronPassword', password)
     .then(success => observer2.next(1), error => observer2.next(1));
   this.storage
     .set('loggedIn', true)
     .then(success => observer2.next(1), error => observer2.next(1));
 });
开发者ID:CIRDLES,项目名称:CHRONI,代码行数:11,代码来源:GeochronUtility.ts

示例8:

 this.storageApp.get('favoris').then(async val => {
   if (!val) {
     const fav = new Array<Media>();
     fav.push(media);
     this.storageApp.set('favoris', fav);
     return
   }
   if (await this.isIncludes(val, media)) return
   val.push(media);
   this.storageApp.set('favoris', val);
 })
开发者ID:PierrePlessy,项目名称:pple_ultimateMovie,代码行数:11,代码来源:storage.service.ts

示例9: performLogout

  /**
   * performLogout
   *
   * unsets current session, thus logging the user out
   */
  performLogout() {
    if (this.platform.is("cordova")) {
      if (this.config) {
        this.pushProv.unsubscribeToPush(this.config);
        this.storage.set("config", null);
      }
    } else { this.storage.set("config", null); }

    this.cache.clearAll();
    this.storage.set("session", null);
    this.storage.set("pushRegistered", false);
    this.navCtrl.setRoot(SelectModulePage);
  }
开发者ID:University-of-Potsdam-MM,项目名称:ReflectUP,代码行数:18,代码来源:logout.ts

示例10: setTimeout

      setTimeout(() => {
        if (email && password) {
            var token = "SomeRandomTokenFromServer";
          this.storage.set('userToken', token);
          resolve(token);

        } else {

          this.storage.set('userToken', null);
          resolve(null);

        }
      }, 3000);
开发者ID:theD1360,项目名称:CygnusLoop,代码行数:13,代码来源:auth.ts


注:本文中的@ionic/storage.Storage.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。