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 🙏

© 2024 – Pkg Stats / Ryan Hefner

overseer

v1.0.1

Published

Overseer.js A light weight, simple Object.observe shim

Downloads

5

Readme

Overseer.js A light weight, simple Object.observe shim

Why overseer.js?

Simple : Observe JavaScript Object/Array in simple way;

Small : Only 1.54k after minified!

Use Now :

Unlike native Object.observe , Overseer support FF2.0+ Chrome1.0+ IE8+ Opera9.5+ Safari3+

Basic usage

Overseer.watch(obj,["age"],function(change){
    //Handle Change here
});

Getting Started

Include the overseer.js in your project.

<script src="overseer.js"></script>

nodejs:

npm install overseer

var Overseer=require("overseer");

Example:

Watch obj.name and obj.age

 var obj={name:"wx",age:"24",gen:"male"};
 Overseer.watch(obj,["name","age"],function(change){
        //Handle Change here
   console.log("change ",change.key," from ",change.oldValue," to ",change.newValue);
 });

Then try these:

 obj.name="regou";  // output: "change name from wx to regou"
 obj.age="45";  // output: "change age from 24 to 45"
 obj.name;  //output: "regou"
 obj.age;   //output: 45

Watch Array : Watch arr[0] and arr[1]

var arr=["Tom","Jim","Hank"];
Overseer.watch(arr,[0,1],function(change){
    	//Handle Change here
	 console.log("change ",change.key," from ",change.oldValue," to ",change.newValue);
});

You can unwatch them if you want:

Overseer.unwatch(obj,["name"]); //unwatch obj.name
obj.name="pop"; // no console output,just change the value

APIs


Overseer.support

Boolean. if Browser support Overseer


Overseer.watch(Obj,keyArray,callback[,config]);

Observe one or more properties in this Object(shallow watch).

Obj - Object/Array. The Object/Array you want to observe;

keyArray - Array. The keynames/Index of the Object/Array your want to observe,must be array;

callback - Function. Will pass 1 object with 'key','newValue','oldValue','Obj';

config - Object. Do some config in this optional parameter.

config.highPerformance - Boolean. If you do something crazy and the value changing in very high frequency,you should set it to true(may reduce callback times).Default is false.


Overseer.watchAll(Obj,callback[,config]);

Observe all properties in this Object/Array (shallow watch).


Overseer.unwatch(Obj,keyArray);

Unwatch.


Overseer.unwatchAll(Obj);

Unwatch All properties(shallow) in this Object/Array.Also this will restore the Obj/Array to original.