Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问怎么监听指定一个key,有变化就输出对应的value呢? #6

Open
570295535 opened this issue Jun 16, 2022 · 1 comment

Comments

@570295535
Copy link

用下面这个就监听所有了。
yuxStorage.addEventListener((type, data) => {
console.log(type, data)
})
请问怎么监听指定一个key,有变化就输出对应的value呢?

@XboxYan
Copy link
Contributor

XboxYan commented Jun 16, 2022

@570295535 这个在里面判断一下就行了

yuxStorage.addEventListener((type, data) => {
    if (data.key === 'A') {
        console.log(data.value)
    }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants