1.1.8 • Published 5 years ago

@superjs/observe v1.1.8

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@superjs/observe

use Proxy to observe changes for nested object

Example

const observe = require('@superjs/observe')
let x=observe({a:{b:1}},(change)=>{
  console.log(change)
})
x.a.b=2

The argument change will be output as below:

{
  key: 'a',
  type: 'object',
  data: {
    a: { b: 2 }
  },
  change: {
    key: 'b',
    type: 'object',
    data: { b: 2 },
    change: { data: 2 }
  }
}

For array type, only changes for NormalInteger keys will be tracked:

const observe = require('@superjs/observe')
let x=observe({a:{b:[]}},(change)=>{
  console.log(change)
})
x.a.b.c=2

Nothing will be output.

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago