0.1.1 • Published 4 years ago

proxy-watched v0.1.1

Weekly downloads
8
License
-
Repository
-
Last release
4 years ago

Proxy Watched

Proxy Watched is a tool for watching an object for changes, even if they are deep ones.

I explicitly don't want to know what the change was, so that's not tracked.

Usage

import proxyWatched from 'proxy-watched'
const obj = { a: 'a' }
const watched = proxyWatched(a, () => changes ++)
watched.a = 'A' // changes => 1
watched.b = 'B' // changes => 2

// supports arrays
watched.names = ['Bob', 'Bill'] // changes => 3
watched.names.push('Bobby') // changes => 4