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


TypeScript storage.Storage類代碼示例

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


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

示例1: constructor

  constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, public alertCtrl: AlertController, private WP: WoocommerceProvider) {
    this.newOrder = {};
    this.newOrder.billing = {};
    this.newOrder.shipping = {};
    this.billing_shipping_same = false;

    this.paymentMethods = [
      { method_id: "bacs", method_title: "Direct Bank Transfer" },
      { method_id: "cheque", method_title: "Cheque Payment" },
      { method_id: "cod", method_title: "Cash on Delivery" },
      { method_id: "paypal", method_title: "PayPal" }];

    this.WooCommerce = WP.init(true);

    this.storage.get("userLoginInfo").then((userLoginInfo) => {

      this.userInfo = userLoginInfo.user;

      let email = userLoginInfo.user.email;
      let id = userLoginInfo.user.id;

      this.WooCommerce.getAsync("customers/"+id).then((data) => {

        this.newOrder = JSON.parse(data.body);

      })

    })

  }
開發者ID:arvac,項目名稱:woo,代碼行數:30,代碼來源:checkout.ts

示例2:

	//登出
	signout(): void {
		var that = this;

		this.storage.remove('token').then(() => {
			that.navCtrl.setRoot(LoginPage);
		});
	}
開發者ID:qwb0920,項目名稱:ionic-uuchat,代碼行數:8,代碼來源:setting.ts

示例3: getItem

 private getItem(KEY: string) {
     return this.storage.get(KEY).then((value) => {
         return value;
     }).catch((error) => {
         return error;
     })
 }
開發者ID:Margorah,項目名稱:CharSheetNg2,代碼行數:7,代碼來源:storage.service.ts

示例4: addItem

 addItem(item) {
   return this.storage.get('items').then((items) => {
     items.push(item);
     this.refreshList$.emit(items);
     return this.storage.set('items', items);
   });
 }
開發者ID:Ismaestro,項目名稱:Packing-Up,代碼行數:7,代碼來源:items.service.ts

示例5:

                  }).then(() =>{
                    this.storage.set("url",data.url).then(() =>{

                    }, errorstorage =>{
                      console.log(errorstorage);
                    });
                  }, erroreeliminar =>{
開發者ID:EnriqueTun23,項目名稱:pescaderia,代碼行數:7,代碼來源:home.ts

示例6: get

  get(key: any) {

    let data;

    this.storage.get(key).then(res => data = res );
    console.log(data);
  }
開發者ID:alejo8591,項目名稱:charla-git,代碼行數:7,代碼來源:storage-service.ts

示例7: addCategory

 addCategory(category) {
   return this.storage.get('categories').then((categories) => {
     categories.push(category);
     this.refreshList$.emit(categories);
     return this.storage.set('categories', categories);
   });
 }
開發者ID:Ismaestro,項目名稱:Packing-Up,代碼行數:7,代碼來源:categories.service.ts

示例8:

 this.storage.get("pendingLogQueue").then((val) => {
   console.log("Pending queue: ")
   console.log(val)
   let pendingLog: { service: string, log: any, zone_name: string, program_name: string, module_name: string, log_name: string } = { service: null, log: null, zone_name: null, program_name: null, module_name: null, log_name: null }
   pendingLog.service = suffix
   pendingLog.log = filled_log
   pendingLog.zone_name = details.zone_name
   pendingLog.program_name = details.program_name
   pendingLog.module_name = details.module_name
   pendingLog.log_name = details.log_name
   this.storage.get("user_id").then((user_id) => {
     if (val == null || val == undefined) {
       let temp = {}
       temp[user_id] = [pendingLog]
       this.storage.set("pendingLogQueue", temp)
       this.events.publish("pendingLog:total", 1)
     } else {
       if (Array.isArray(val[user_id])) {
         val[user_id].push(pendingLog)
         this.storage.set("pendingLogQueue", val)
         this.events.publish("pendingLog:total", val[user_id].length)
       } else {
         val[user_id] = [pendingLog]
         this.storage.set("pendingLogQueue", val)
         this.events.publish("pendingLog:total", 1)
       }
     }
   })
 })
開發者ID:caom92,項目名稱:Espresso,代碼行數:29,代碼來源:app.logs.ts

示例9:

 platform.ready().then(() => {
   // Okay, so the platform is ready and our plugins are available.
   // Here you can do any higher level native things you might need.
   statusBar.styleDefault();
   splashScreen.hide();
   this.storage.get("logged").then(value=>this.rootPage = value? HomePage: LoginPage);
 });
開發者ID:milo2005,項目名稱:HeladosIonic,代碼行數:7,代碼來源:app.component.ts


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