本文整理汇总了TypeScript中@ionic/storage.Storage.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Storage.get方法的具体用法?TypeScript Storage.get怎么用?TypeScript Storage.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ionic/storage.Storage
的用法示例。
在下文中一共展示了Storage.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: updateCurrentFiles
public updateCurrentFiles() {
// checks to make sure there are default current files
this.storage.get('currentAliquot').then((value) => {
if (!value) {
// sets the current Aliquot to the Default Aliquot
this.getFile('chroni/Aliquots/Default Aliquot.xml')
.subscribe(
file => {
this.storage.set('currentAliquot', file);
console.log('Set current Aliquot to Default Aliquot...');
},
error => console.log("Could not set current Aliquot... " + error.message)
);
}
});
this.storage.get('currentReportSettings').then((value) => {
if (!value) {
// sets the current Report Settings to the Default Report Settings
this.getFile('chroni/Report Settings/Default Report Settings.xml')
.subscribe(
file => {
this.storage.set('currentReportSettings', file);
console.log('Set current Report Settings to Default Report Settings...');
},
error => console.log("Could not set current Report Settings... " + error.message)
);
}
});
}
示例2: constructor
constructor(public navCtrl: NavController, private storage: Storage,
private barcodeScanner: BarcodeScanner, public alertCtrl: AlertController) {
this.storage.get('apiKey').then(
v => this.apiKey = v
);
this.storage.get('privateKey').then(
v => this.privateKey = v
);
}
示例3: ionViewDidLoad
ionViewDidLoad() {
console.log('ionViewDidLoad SettingsPage');
this.storage.get('country')
.then(c => {
this.defaultCountry = c || 'eg';
})
this.storage.get('language')
.then(l => {
this.defaultLanguage = l || 'en';
})
this.storage.get('color')
.then(color => {
this.defaultColor = color || 'red';
})
}
示例4: deleteCategory
deleteCategory(category) {
return this.storage.get('categories').then((categories) => {
return this.storage.get('items').then((items) => {
for (let i = 0; i < categories.length; i++) {
if (categories[i].id === category.id) {
categories.splice(i, 1);
}
}
for (let i = 0; i < items.length; i++) {
if (items[i].categoryId === category.id) {
delete items[i];
}
}
items = this.cleanArray(items);
return this.storage.set('items', items).then(() => {
this.itemsService.refreshList$.emit(items);
this.refreshList$.emit(categories);
return this.storage.set('categories', categories);
});
});
});
}
示例5: addCategory
addCategory(category) {
return this.storage.get('categories').then((categories) => {
categories.push(category);
this.refreshList$.emit(categories);
return this.storage.set('categories', categories);
});
}
示例6:
this.storage.get("user_id").then(user_id => {
if (user_id != null && user_id != undefined) {
this.storage.get("pendingLogQueue").then((pending) => {
if (pending != undefined && pending != null) {
if (pending[user_id] != null && pending[user_id] != undefined) {
if (pending[user_id][index] != undefined && pending[user_id][index] != null) {
let logToProcess: PendingLog = pending[user_id][index]
this.send(logToProcess.log, logToProcess.service, { zone_name: logToProcess.zone_name, program_name: logToProcess.program_name, module_name: logToProcess.module_name, log_name: logToProcess.log_name }, false).then(success => {
pending[user_id].splice(index, 1)
this.storage.set("pendingLogQueue", pending)
this.events.publish("log:resent", index)
}, error => {
// TODO: Ni se, en si no tenemos que hacer nada v:
console.log("fail")
console.log(error)
})
} else {
throw "Error while processing pending log: log index is out of range"
}
} else {
throw "Error while processing pending log: user has no pending logs"
}
} else {
throw "Error while processing pending log: no pending logs in storage"
}
})
}
})
示例7: ionViewWillEnter
ionViewWillEnter() {
this.storage.get('roomInfo').then( data => {
return this.room = data.room;
}).then( _ => {
this.update();
});
}
示例8: ionViewDidLoad
ionViewDidLoad() {
// this.LocStorageData = this.storage.getDataFromStorage();
// if (this.LocStorageData.mm === null || this.LocStorageData.mm === '') {
// this.initLocalStorage();
// } else {
// this.mm = localStorage.mm;
// this.dd = localStorage.dd;
// this.monthVal = localStorage.month;
// this.weekVal = localStorage.week;
// this.fromModelGrp = localStorage.fromModelGrp;
// this.toModelGrp = localStorage.toModelGrp;
// }
//console.log('ionViewDidLoad SettingsPage');
this.storage.get('settingsData').then(value => {
this.LocStorageData = JSON.parse(value);
this.dd = this.LocStorageData.dd;
this.mm = this.LocStorageData.mm;
this.monthVal = this.LocStorageData.monthVal;
this.weekVal = this.LocStorageData.weekVal;
this.toModelGrp = this.LocStorageData.toModelGrp;
this.fromModelGrp = this.LocStorageData.fromModelGrp;
this.fromDate = this.LocStorageData.fromDate;
this.toDate = this.LocStorageData.toDate;
this.modelSeason = this.LocStorageData.modelSeason;
this.modelYear = this.LocStorageData.modelYear;
this.selectedChkbox = this.LocStorageData.selectedChkbox;
this.displayMode= this.LocStorageData.displayMode;
});
}
示例9: get
get(key: any) {
let data;
this.storage.get(key).then(res => data = res );
console.log(data);
}
示例10: constructor
constructor(public navCtrl: NavController, public navParams: NavParams, public translationService: TranslationService, public events: Events, public storage: Storage, private toastService: ToastsService, public server: BackendService) {
super(translationService, events, storage, server)
// Tenemos que ver desde quĂŠ programa se llamĂł esta vista
this.selectedProgram = navParams.get('program');
this.selectedModule = navParams.get('module');
this.logs = [];
storage.get("privileges").then(
data => {
data = JSON.parse(data)
var tempArray = Object.getOwnPropertyNames(data[data.zones[0].name][this.selectedProgram.code].names[this.selectedModule.title])
let invArray = data[data.zones[0].name][this.selectedProgram.code].names[this.selectedModule.title]
for (var mod of tempArray) {
if (this.selectedProgram.target == "log") {
this.logs.push({
title: mod,
icon: "clipboard",
program: this.selectedProgram,
module: this.selectedModule
});
} else {
if (invArray[mod].has_inventory == "1") {
this.logs.push({
title: mod,
icon: "clipboard",
program: this.selectedProgram,
module: this.selectedModule
});
}
}
}
}
)
}