本文整理汇总了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);
})
})
}
示例2:
//çťĺş
signout(): void {
var that = this;
this.storage.remove('token').then(() => {
that.navCtrl.setRoot(LoginPage);
});
}
示例3: getItem
private getItem(KEY: string) {
return this.storage.get(KEY).then((value) => {
return value;
}).catch((error) => {
return error;
})
}
示例4: addItem
addItem(item) {
return this.storage.get('items').then((items) => {
items.push(item);
this.refreshList$.emit(items);
return this.storage.set('items', items);
});
}
示例5:
}).then(() =>{
this.storage.set("url",data.url).then(() =>{
}, errorstorage =>{
console.log(errorstorage);
});
}, erroreeliminar =>{
示例6: get
get(key: any) {
let data;
this.storage.get(key).then(res => data = res );
console.log(data);
}
示例7: addCategory
addCategory(category) {
return this.storage.get('categories').then((categories) => {
categories.push(category);
this.refreshList$.emit(categories);
return this.storage.set('categories', categories);
});
}
示例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)
}
}
})
})
示例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);
});