1.0.4 • Published 1 year ago

obj-observer v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

obj-observer

js/ts 对象监听

  1. 安装依赖
npm install obj-observer
# 或 npm i
  1. 在需要的地方引入watch方法,监听对象或数组的变化
import {ref,watch} from 'obj-observer'
const obj=ref({test:123})
const dispose=watch(obj,
    (value,oldValue)=>{
        console.log('trigger change',value,oldValue)
    })
obj.test='hi world' //'trigger change' {test:'hello world'} {test:'hi world'} 
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago