0.0.33 • Published 10 months ago
@wepin/storage-js v0.0.33
@wepin/storage-js
Wepin Storage Library from Web. This package is only available in the web environment.
⏩ Install
npm install @wepin/storage-jsor
yarn add @wepin/storage-js⏩ Import SDK
WepinStorage from '@wepin/storage-js'⏩ Methods
getLocalStorage
WepinStorage.getLocalStorage(appId, name)Returns the value of the specified local storage item.
Parameters
appId\name\
Example
WepinStorage.getLocalStorage('APP_ID', 'KEY')getAllLocalStorage
WepinStorage.getAllLocalStorage(appId)Returns all local storage data.
Parameters
appId\
Example
WepinStorage.getAllLocalStorage('APP_ID')setLocalStorage
WepinStorage.setLocalStorage(appId, name, value)Sets the value of the specified local storage item.
Parameters
appId\name\value\
Example
WepinStorage.setLocalStorage('APP_ID', 'KEY', 'data')setAllLocalStorage
WepinStorage.setAllLocalStorage(appId, values)Sets all local storage data.
Parameters
appId\values\
Example
WepinStorage.setAllLocalStorage('APP_ID', 'data')clearLocalStorage
WepinStorage.clearLocalStorage(appId, name)Clears the value of the specified local storage item.
Parameters
appId\name\
Example
WepinStorage.clearLocalStorage('APP_ID', 'KEY')clearAllLocalStorage
WepinStorage.clearAllLocalStorage(appId)Clears all local storage data.
Parameters
appId\
Example
WepinStorage.clearAllLocalStorage('APP_ID')setLoginUserLocalStorage
WepinStorage.setLoginUserLocalStorage(
appId: string,
request: {
provider: string
token: { idToken: string; refreshToken: string }
},
response: any,
)Sets the user information of the local storage.
Parameters
appId\request\ - response of@wepin/loign-jsmethodsresponse\ - response of wepin login api
Example
import {WepinFetch} from '@wepin/fetch-js'
import {WepinLogin} from '@wepin/login-js'
const wepinLogin = new WepinLogin({
appId: 'APP_ID',
appKey: 'APP_KEY',
})
const wepinFetch = new WepinFetch({
appId: 'APP_ID',
appKey: 'APP_KEY',
domain: 'APP_DOMAIN',
sdk: {version: 'SDK_VERSION', type: "SDK_TYPE"}
})
const req = await wepinLogin.loginWithIdToken({token, sign})
const res = await wepinFetch.wepinApi.user.login({
idToken: req.token.idToken,
})
WepinStorage.setLoginUserLocalStorage('APP_ID', req, res)0.0.33
10 months ago
0.0.31
11 months ago
0.0.32
11 months ago
0.0.30
1 year ago
0.0.29
1 year ago
0.0.25
1 year ago
0.0.26
1 year ago
0.0.27
1 year ago
0.0.28
1 year ago
0.0.23
1 year ago
0.0.24
1 year ago
0.0.22
1 year ago
0.0.21
1 year ago
0.0.20
1 year ago
0.0.18
1 year ago
0.0.19
1 year ago
0.0.17
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.4
2 years ago
0.0.1
2 years ago