Skip to content

Latest commit

 

History

History

single-observer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

响应式数据最简实现

API

const target = { a: {b: {c: 1 } } }

const observable = singleObserver(target)

console.log(isObservable(observable)) // T

observable.subscribe(() => {
  console.log('changed')
})

observable.a.b.c = 1
// print changed

observable.a.b = { d: 'foo' }
// print changed