feat:add StoragePlugin for Android

This commit is contained in:
pengfei.zhou
2019-11-22 09:48:45 +08:00
parent 1545f71293
commit 83d71e1703
5 changed files with 138 additions and 5 deletions

View File

@@ -149,4 +149,21 @@ export function network(context: BridgeContext) {
return context.network.request(transformRequest(finalConfig)) as Promise<IResponse>
},
}
}
export function storage(context: BridgeContext) {
return {
setItem: (key: string, value: string, zone?: string) => {
return context.storage.store({ key, value, zone })
},
getItem: (key: string, zone?: string) => {
return context.storage.retreive({ key, zone }) as Promise<string>
},
remove: (key: string, zone?: string) => {
return context.storage.remove({ key, zone })
},
clear: (zone: string) => {
return context.storage.clear(zone)
},
}
}