Feature/zpf (#564)

* iOS: fix memory leak of blur effect

* js: fix callback cause memory leak
This commit is contained in:
osborn
2022-12-20 15:06:46 +08:00
committed by GitHub
parent c60754c53d
commit be4fb05f91
13 changed files with 77 additions and 22 deletions

View File

@@ -73,14 +73,22 @@ class CounterView extends ViewHolder {
class CounterVM extends ViewModel<CountModel, CounterView> {
onAttached(s: CountModel, vh: CounterView) {
vh.counter.onClick = () => {
Promise.resolve(this.getState().count).then(count => {
Promise.resolve().then(() => {
this.updateState((state) => {
state.count = count + 1;
});
})
})
setInterval(() => {
// this.updateState(state => {
// state.count++
// })
this.context.callNative("demo", "test2", "sdfsf")
//loge("setInterval")
}, 1)
};
vh.number.onClick = () => {
setInterval(() => {
// this.updateState(state => {
// state.count++
// })
this.context.callNative("demo", "test")
}, 1)
}
}
onBind(s: CountModel, vh: CounterView) {
vh.number.text = `${s.count}`;