本文整理汇总了TypeScript中@ionic/storage.Storage.ready方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Storage.ready方法的具体用法?TypeScript Storage.ready怎么用?TypeScript Storage.ready使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ionic/storage.Storage
的用法示例。
在下文中一共展示了Storage.ready方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, public events: Events) {
storage.ready().then(() => {
storage.get("dbList").then((val) => {
this.universities = val;
})
});
}
示例2: initStorage
async initStorage() {
await this.storage.ready()
await this.storage.clear()
const raw = await this.http.get('/assets/preload.json').toPromise()
const data = raw.json()
return Promise.all(
Object.entries(data).map(([key, recipe]) =>
this.storage.set(key, recipe)))
}
示例3: updateList
updateList(){
this.storage.ready().then(() => {
this.storage.get("dbList").then((oldList) => {
const storageHandler = new StorageHandler();
const updatedList = storageHandler.updateUniversityList(this.item, oldList);
this.storage.set("dbList", updatedList);
this.events.publish("dbList:update");
})
});
}
示例4: constructor
constructor (
storage: Storage
) {
this.storage = storage;
this.storage.ready().then(() => {
this.init();
});
}
示例5: constructor
constructor(public navCtrl: NavController, universityService:UniversityService, storage: Storage ) {
storage.ready().then(() => {
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 );
})
});
}
示例6: load
/**
* Load (async) all WaypointPath saved in the underlying storage
*/
async load(): Promise<WaypointPath[]> {
await this.storage.ready();
let waypointsIds: Array<string> = await this.storage.get(SettingsKeys.WAYPOINTS) || [];
let waypointsPromises: Promise<WaypointPath>[] = waypointsIds.map(wp => this.storage.get(wp));
let waypoints = [];
for (var i in waypointsPromises){
waypoints[i] = await waypointsPromises[i];
}
return waypoints.map(waypointPath => WaypointPath.from(waypointPath));
}
示例7:
this.events.subscribe("updateMenu", () => {
this.storage.ready().then(() => {
this.storage.get("userLoginInfo").then((userLoginInfo) => {
if (userLoginInfo != null) {
console.log("User logged in...");
this.user = userLoginInfo.user;
console.log(this.user);
this.loggedIn = true;
}
else {
console.log("No user found.");
this.user = {};
this.loggedIn = false;
}
})
});
})
示例8: ionViewDidEnter
ionViewDidEnter() {
this.storage.ready().then(() => {
this.storage.get("userLoginInfo").then((userLoginInfo) => {
if (userLoginInfo != null) {
console.log("User logged in...");
this.user = userLoginInfo.user;
console.log(this.user);
this.loggedIn = true;
}
else {
console.log("No user found.");
this.user = {};
this.loggedIn = false;
}
})
})
}
示例9: ready
public ready() {
return this.storage.ready();
}