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


TypeScript ionic-angular.Storage類代碼示例

本文整理匯總了TypeScript中ionic-angular.Storage的典型用法代碼示例。如果您正苦於以下問題:TypeScript Storage類的具體用法?TypeScript Storage怎麽用?TypeScript Storage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Storage類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor(public nav: NavController,
       public view: ViewController,
       public translate: TranslateService) {
   this.local = new Storage(LocalStorage);
   var userLang = navigator.language.split('-')[0];
   userLang = /(de|en|hr)/gi.test(userLang) ? userLang : 'en';
   this.local.get('language')
     .then((l) => {
       if (l) {
         this.language = l;
       } else {
         this.language = userLang;
       }
     });
 }
開發者ID:quanganh206,項目名稱:ionic2-kitchen-sink-ts,代碼行數:15,代碼來源:settings.ts

示例2: constructor

  constructor(private navCtrl: NavController, private navParams: NavParams, private loadingCtrl: LoadingController, private modalCtrl: ModalController) {
    this.global = this.navParams.get('global');
    this.sku = this.navParams.get('sku');
    this.name = this.navParams.get('name');

    this.slideOptions = {
      autoplay: 2000,
      loop: true,
      pager: true
    };
    
    this.global.subData = {};    
    this.global.isLoaded = false;
    let loader = this.loadingCtrl.create({
      content: this.global.message.pleaseWait+"...",
    });
    loader.present();

    var timer = setInterval(() => {
      if(this.global.isLoaded) {
        clearInterval(timer);
        loader.dismiss();
      }
    }, 500);

    let storage = new Storage(LocalStorage);
    storage.get('token').then((token) => {
      this.global.socket.emit('api', {
        token: token,
        module: 'product',
        action: 'info',
        sku: this.sku
      });
    });

  }
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:36,代碼來源:product.ts

示例3: logout

  logout() {
    localStorage.removeItem('appKey');
    localStorage.removeItem('appSecret');
    localStorage.removeItem('consumerKey');
    localStorage.removeItem('widgets');
    localStorage.removeItem('credentials');
    localStorage.removeItem('connected');
    this.ovhRequest.setConfiguration({});

    return this.nav.setRoot(LoginPage);
  }
開發者ID:SCORE42,項目名稱:my-infra,代碼行數:11,代碼來源:login.service.ts

示例4: function

    global.socket.on('access', function (data) {
      if (data.success) {
        storage.set('token', data.token);
        global.socket.emit('api', {
          token: data.token,
          module: 'system',
          action: 'language',
          system: 'mobile',
          langCode: global.langCode
        });

        global.socket.emit('api', {
          token: data.token,
          module: 'system',
          action: 'screen'
        });

        //-- ข้อมูลจำนวนสินค้าในรถเข็น --//
        global.socket.emit('api', {
          token: data.token,
          module: 'cart',
          action: 'summary'
        });

      }
      else {
        storage.remove('token');
        if (retryCount < 3) {
          global.socket.emit('access', { token: '' });
          retryCount++;
        }
        else {
          alert(data.error + "\n" + data.errorMessage);
        }
      }
    });
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:36,代碼來源:app.ts

示例5: getTasks

 getTasks(){
   let sql =  `SELECT * from tasks`;
   return this.tasks.query( sql )
   .then(response =>{
     let data = [];
     for (let index = 0; index < response.res.rows.length; index++) {
       data.push({
         id: response.res.rows[index].id,
         title: response.res.rows[index].title,
         completed: response.res.rows[index].completed == "true" ? true : false
       });
     }
     return Promise.resolve(data);
   });
 }
開發者ID:EscuelaIt,項目名稱:class7-ionic-2,代碼行數:15,代碼來源:tasks-websql.ts

示例6: save

  save(data): void {
    let saveData = [];

    //Remove Observables
    data.forEach((checklist) => {
      saveData.push({
        title: checklist.title,
        items: checklist.items,
        createdOn: checklist.createdOn
      });
    });

    let newData = JSON.stringify(saveData);
    this.storage.set('checklist', newData);
  }
開發者ID:digitaldrummerj,項目名稱:ionic2-book-quicklist,代碼行數:15,代碼來源:data.ts

示例7: Promise

        return new Promise((resolve, reject) => {
            //this.platform.ready().then(() => {
                /*this.storage.query('CREATE TABLE IF NOT EXISTS data (key TEXT PRIMARY KEY, value TEXT)').then((data) => {

                    this.storage.query("INSERT OR IGNORE INTO data (key, value) VALUES " + 
                                "('familias', '')," +
                                "('likes', '')," +
                                "('entity', '')," +
                                "('user', '')," +
                                "('tiposElementos', '')," +
                                "('tiposIncidencias', '')," +
                                "('estados', '')," +
                                "('responsables', '')," +
                                "('firstRun', '')," +
                                "('language', '');").then((data) => {

                        resolve(data);

                    }, (error) => {
                        //reject("ERROR -> " + error);
                        console.log(error);
                    });

                }, (error) => {
                    //reject("ERROR -> " + error);
                    console.log(error);
                });*/


                this.storage.query("INSERT OR IGNORE INTO kv (key, value) VALUES " + 
                                "('familias', '')," +
                                "('likes', '')," +
                                "('entity', '')," +
                                "('user', '')," +
                                "('tiposElementos', '')," +
                                "('tiposIncidencias', '')," +
                                "('estados', '')," +
                                "('responsables', '')," +
                                "('firstRun', '')," +
                                "('language', '');").then((data) => {

                        resolve(data);

                    }, (error) => {
                        //reject("ERROR -> " + error);
                        console.log(error);
                    });
            });
開發者ID:GECOR,項目名稱:gecor-generic-2016,代碼行數:48,代碼來源:db.ts

示例8:

        storage.get('page').then((page) => {
          if (page == 'signOut' || page == 'signIn') {
            storage.set('page', 'shopping');
            global.socket.emit('api', {
              token: data.token,
              module: 'system',
              action: 'screen'
            });

            global.socket.emit('api', {
              token: data.token,
              module: 'member',
              action: 'profile'
            });
          }
        });
開發者ID:RemaxThailand,項目名稱:RemaxMobile,代碼行數:16,代碼來源:app.ts

示例9: KEY

 ');').then((data) => {
   this.storage.query('CREATE TABLE IF NOT EXISTS Base_atribute (' +
     '_id INTEGER PRIMARY KEY AUTOINCREMENT,' +
     'System_id INTEGER,' +
     'name TEXT NULL,' +
     'FOREIGN KEY(System_id) REFERENCES System(_id)' +
     ');').then((data) => {
       this.storage.query('CREATE TABLE IF NOT EXISTS Secundary_atribute (idSecundary_atribute INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT);')
         .then((data) => {
           this.storage.query('CREATE TABLE IF NOT EXISTS Characters_has_Skill (' +
             'Characters_idCharacters INTEGER,' +
             'Skill_idSkill INTEGER,' +
             'level INTEGER UNSIGNED NULL,' +
             'FOREIGN KEY(Characters_idCharacters) REFERENCES Characters(_id),' +
             'FOREIGN KEY(Skill_idSkill) REFERENCES Skill(_id)' +
             ');').then((data) => {
               this.storage.query('CREATE TABLE IF NOT EXISTS Characters_has_Secundary_atribute (' +
                 'Characters_idCharacters INTEGER,' +
                 'Secundary_atribute_idSecundary_atribute INTEGER,' +
                 'value INTEGER,' +
                 'FOREIGN KEY(Characters_idCharacters) REFERENCES Characters(_id),' +
                 'FOREIGN KEY(Secundary_atribute_idSecundary_atribute) REFERENCES Secundary_atribute(_id)' +
                 ');').then((data) => {
                   this.storage.query('CREATE TABLE IF NOT EXISTS Characters_has_Base_atribute (' +
                     'Characters_idCharacters INTEGER,' +
                     'Base_atribute_idBase_atribute INTEGER,' +
                     'value INTEGER,' +
                     'FOREIGN KEY(Characters_idCharacters) REFERENCES Characters(_id),' +
                     'FOREIGN KEY(Base_atribute_idBase_atribute) REFERENCES Base_atribute(_id)' +
                     ');').then((data) => {
                       console.log("DB OK");
                     }, (error) => {
                       console.log("Characters_has_Base_atribute ERROR -> " + JSON.stringify(error.err), error);
                     });
                 }, (error) => {
                   console.log("Characters_has_Secundary_atribute ERROR -> " + JSON.stringify(error.err), error);
                 });
             }, (error) => {
               console.log("Characters_has_Skill ERROR -> " + JSON.stringify(error.err), error);
             });
         }, (error) => {
           console.log("Secundary_atribute ERROR -> " + JSON.stringify(error.err), error);
         });
     }, (error) => {
       console.log("Base_atribute ERROR -> " + JSON.stringify(error.err), error);
     });
 }, (error) => {
開發者ID:DaniloCouto,項目名稱:Ionic_2_RPG_Character_Database,代碼行數:47,代碼來源:sql-helper.ts


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