本文整理汇总了TypeScript中localforage.removeItem函数的典型用法代码示例。如果您正苦于以下问题:TypeScript removeItem函数的具体用法?TypeScript removeItem怎么用?TypeScript removeItem使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removeItem函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
return Observable.create(observer => {
localStorage.removeItem('authToken');
localforage
.removeItem('currentUser')
.then(() => {
this.events.emit({
type: 'auth',
base: this.BASE_URL,
data: false
});
observer.next('logged out');
observer.complete();
});
});
示例2: clearState
static async clearState(userId: string): Promise<any> {
console.log(LocalStore.getKey(userId));
return await localForage.removeItem(LocalStore.getKey(userId), err => console.error(err));
}
示例3: _reset
public async _reset(key) {
LocalForage.removeItem(key);
}
示例4:
.then(() => localforage.removeItem('test3'))
示例5: Api
const api = new Api(API_ENDPOINT)
const loginResult = await api.authenticateUser(authResult.accessToken)
commit('RECEIVE_USER', loginResult)
dispatch('storeUser', loginResult)
},
async storeUser (ctx, user) {
await localForage.setItem('user', user)
},
async getStoredUser ({ commit }) {
const user = await localForage.getItem('user')
if (user) commit('RECEIVE_USER', user)
},
async logout ({ commit }) {
await localForage.removeItem('user')
commit('RESET_USER')
},
async getRecipients ({ state, commit }) {
const token = state.user.token
const userId = state.user.id as string
const api = new Api(API_ENDPOINT, token)
const recipients = await api.getRecipients(userId)
commit('RECEIVE_RECIPIENTS', recipients)
}
}
export default actions