Global

Type Definitions

CallbackNotAFunction

Source:
Properties:
Name Type Default Description
name string CallbackNotAFunction Name of the error.
message string Message of the error.
Error throw when one calls onChange passing a callback parameter that is not a function.
Type:
  • Error
Example
const watcher = require("obj-watcher");

watcher.watch("status", { online: true });
//Throws, second parameter should be of type "function".
watcher.onChange("status", "I am not a function!");

ObjectAlreadyWatched

Source:
Properties:
Name Type Default Description
name string ObjectAlreadyWatched Name of the error.
message string Message of the error.
Error thrown when one tries to re-watch an object that was already being watched. This means that you are trying to watch an object and that the library already has something with the given {Id}.
Type:
  • Error
Example
const watcher = require("obj-watcher");

watcher.watch("status", { online: true });
watcher.watch("status", { fruit: "banana" }); //Throws, key "status" is already under use.

ObjectNotWatched

Source:
Properties:
Name Type Default Description
name string ObjectNotWatched Name of the error.
message string Message of the error.
Error thrown when one tries to perform an action on an object that was not previously registered using watch.
Type:
  • Error
Example
const watcher = require("obj-watcher");

watcher.unwatch("status"); //Throw, "status" is not watched.