npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ko-deep-watcher

v1.0.0

Published

Deeply and dynamically observe an object hierarchy

Readme

Knockout Deep Watcher

Deeply and dynamically observe an object hierarchy. This knockout plugin will scan an object or array for observables, scanning the entire object graph, subscribing to each observable. As observable values are changed, those values are then scanned so the plugin continues to monitor changes that occur within the object graph.

API

The deep watcher hooks into Knockout's subscribe method, using "deep" as the event name.

observable.subscribe(callback, thisArg, "deep");

The subscription callback will return a single argument object with the following properties:

  • target - The observable which triggered the subscription.
  • parent - The parent object or array of the target.
  • key - The property name or index of the target.
  • value - The new value of the target after the change.
  • priorValue - The value of the object before the change.

There are convenience methods attached to the knockout global (ko) as well.

ko.watch(target, callback, options);
  • target - Object - The target is the object to be scanned. (The target does not need to be an observable itself.)

  • callback - Function - The subscription callback.

  • options (optional) - Object - Options to use when subscribing. There are two options:

    • valueAccessor - Function - A function which receives the value, key (propertyName/index), and the object. You should return the value to be used for subscribing to. This is useful if your observables are wrapped in ES5 property getters - you can get the underlying observable and return that to be observed.

    • shouldWatch - Function - A function which receives the observable, key, and object. Return true if you'd like the observable to be watched or false for it to be ignored.

There is also a watch method added to subscribable instances which can be used for ignoring observables or pausing notifications from the observable.

// ignore changes
observable.watch(false);

// do stuff without triggering notifications

// resume watching
observable.watch(true);

(If a function is passed to this method, it creates a deep subscription to the observable using the function as callback.)

Default options can be set on ko.watch.defaultOptions and will be used unless overriden during the subscription.