
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
@react-native-pure/async-storage-extra
Advanced tools
AsyncStorage扩展,所有AsyncStorage中的数据都可以同步进行读写,同时数据也会被持久化.可以监听每个key的变化
$ npm i @react-native-pure/async-storage-extra --save
import Storage from "@react-native-pure/async-storage-extra
const User=new Storage("@user");
User.setItem("name","Mr");
User.setItem("age",10);
User.setItem("birthday",new Date());
User.setItem("other",{});
import * as React from "react"
import {View,Text} from "react-native"
import {storage} from "@react-native-pure/async-storage-extra
@storage(
User.connect(["name","age"],([name,age])=>({name,age}))
)
class User extends React.Component{
render(){
return (
<View>
<Text>Name : {this.props.name}</Text>
<Text>Age : {this.props.age}</Text>
</View>
);
}
}
默认情况下,在初始化Storage时会自动从AsyncStorage中恢复数据,数据恢复完成会触发onPreload事件.
PS:当使用setItem,multiSet设置的数据和存在的数据一样时(DeepEqual),将不会触发任何事件和写操作.
constructor (option:string|StorageOption={prefix:"@storage",preload:true})=>voidgetItem (key:string)=>anymultiGet (keys:Array)=>Array<[key,value]>search (pattern:RegExp)=>Array<[key,value]>setItem (key:string,value:any)=>voidmultiSet (keyValuePairs:Array<[key,value]>)=>voidremoveItem (key:string)=>voidmultiRemove (keys:Array)=>voidclear ()=>voidgetAllKeys ()=>ArraygetKeys (pattern:RegExp)=>ArrayaddListener (key:string,callback:(value:any)=>void)=>Objectonce (key:string,callback:(value:any)=>void)=>ObjectremoveAllListeners (key:string)=>voidconnect (keys:Array,mapStateToProps:(Array)=>Object)=>voidrestore ()=>void 从AsyncStorage中恢复数据release ()=>void 释放内存,Storage中的数据将不可用prefix stringpreload booleanonPreload (self:Storage)=>voidFAQs
AsyncStorage扩展
The npm package @react-native-pure/async-storage-extra receives a total of 11 weekly downloads. As such, @react-native-pure/async-storage-extra popularity was classified as not popular.
We found that @react-native-pure/async-storage-extra demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.