本文整理汇总了TypeScript中@ionic/storage.Storage.clear方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Storage.clear方法的具体用法?TypeScript Storage.clear怎么用?TypeScript Storage.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ionic/storage.Storage
的用法示例。
在下文中一共展示了Storage.clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: clearData
clearData() {
this.storage.clear();
this.gameService.planetName = 'Exodus';
this.gameService.game = new Game();
this.gameService.generatePlanets(3);
this.storage.set('game', JSON.stringify(this.gameService.game));
this.navCtrl.goToRoot({});
}
示例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:
}).toPromise().then((res:any) => {
let data = res;
console.log(data);
if (data.result === false) {
let alert = this.alertCtrl.create({
title: 'Ops',
subTitle: 'username and password are incorrent!',
buttons: ['OK'],
});
alert.present();
} else {
this.storage.clear().then(()=>{
this.storage.set('user', {
userName:uname,
imgUrl:data.imgUrl,
user:data.user,
}).then((result) => {
if (result ) {
this.navCtrl.push(HomePage1); //跳转
} else {
let alert = this.alertCtrl.create({
title: 'Opss',
subTitle: 'cannot save user info',
buttons: ['OK'],
});
alert.present();
}
}).catch((error) => {
//出错了弹框
let alert = this.alertCtrl.create({
title: 'Opss',
subTitle: error,
buttons: ['OK'],
});
alert.present();
})
});
}
}).catch((error:Error) => {
示例4: removeAll
removeAll(){
return this._storage.clear()
}
示例5: resetData
resetData() {
this.storage.clear();
}
示例6: clear
public clear(): any {
return this.storage.clear();
}
示例7: signOut
signOut() {
//this.storage.remove('user')
this.storage.clear()
return this.afAuth.auth.signOut()
}
示例8: clear
clear() {
return this.storage.clear();
}
示例9: clearStorage
clearStorage() {
this.storage.clear();
}
示例10: loginOut
loginOut() {
this.events.publish('messageCount', 0);
this.storage.clear();
this.badge.clear().then().catch(error => console.log(error));
this.navCtrl.pop();
}