Skip to content
A simple array and object watcher function for Deno. Written in TypeScript.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple array and object watcher function for Deno.

DenoLib Build Status

Table of Contents


import { watch } from '';

A simple example of how to use Panoptes's watch().

import { watch } from '';

// Example interface for the base object.
interface BaseObjectStruct {
  a: String;
  b: {
    c: Array<String>;
  e: Number;

// The base object that will be watched.
const baseObject: BaseObjectStruct = {
  a: 'a',
  b: {
    c: ['d'],
  e: 1,

// The new reference object that is being watched.
const watchedObject: any = watch(
  () => {
    console.log('Something happened!');
    callbackOnGet: false,

// The watch callback should fire for each execution below.
watchedObject.a = 'b';
watchedObject.b.c.push('e'); // Array methods will fire the callback multiple times.
delete watchedObject.e;

//> Something happened!
//> Something happened!
//> Something happened!
//> Something happened!



watch(object: Object, callback: Function, options?: OptionsStruct);

object: Object

The base object in which you would like watched.

callback: Function<void>

The callback that will be fired on change. Function should not return.

options?: Object

The options object passed into the watch() function. This is optional and implements the interface OptionsStruct.

interface OptionsStruct {
  callbackOnGet: Boolean;

Setting this to true will enable the watcher to fire the callback function on get operations. Not setting it will disable this feature.

You can’t perform that action at this time.