GitShow/sindresorhus/on-change
sindresorhus

on-change

Watch an object or array for changes

by sindresorhus
change-detectiones2015-proxynodejsnpm-packageobjectwatch
Star on GitHubForknpm

JavaScript

2.0k stars88 forks21 contributorsQuiet · 5mo agoSince 2017v6.0.2MIT

Meet the team

See all 21 on GitHub →
DarrenPaulWright
DarrenPaulWright73 contributions
sindresorhus
sindresorhus45 contributions
BendingBender
BendingBender2 contributions
hpx7
hpx72 contributions
kpruden
kpruden2 contributions
albertosantini
albertosantini1 contribution
Seldszar
Seldszar1 contribution
brendon1982
brendon19821 contribution

Recent fixes

View closed PRs →
lroal
onValidate does not work with arraysClosedIssue

output: The change seems to be already done when onValidate is called.

lroal · 5mo ago
NathanFlurry
fix: fix support for proxying `ArrayBuffer` and `SharedArrayBuffer`MergedPR

Fixes this error when proxying ArrayBuffers:

NathanFlurry · 5mo ago
remyguillaume
Question about the usage on details:true and listsClosedIssue

Hello, I am using on-change to watch changes in the state of my application. Until now, I was using the default configuration. With this, when I listen to a change in my list, if I add a new element in my list, the path I get in the onChange method if the array itself. For example: And when I do , then the path in the onChange method is . Now, I add some problems with some functions like , which were not triggering all the events, but only one event at the end of the loop. So I've tried to activated the options, as documented. This worked well, except that now the path has changed when I add elements in my list. For example, now I have: And when I do , then the path in the onChange method is now . I don't really understand the philosophy here. Is it intentional? Is it a bug? (I could perhaps try to sove it by myself in a Pull-Request, but I would be happy to discuss this before.) Thanks.

remyguillaume · 5mo ago
Structured data for AI agents

Repository: sindresorhus/on-change. Description: Watch an object or array for changes Stars: 2027, Forks: 88. Primary language: JavaScript. License: MIT. Topics: change-detection, es2015-proxy, nodejs, npm-package, object, watch. Latest release: v6.0.2 (5mo ago). Open PRs: 0, open issues: 0. Last activity: 5mo ago. Top contributors: DarrenPaulWright, sindresorhus, BendingBender, hpx7, kpruden, albertosantini, Seldszar, brendon1982, franciscop, glundgren93 and others.

·@ofershap

Replace github.com with gitshow.dev