This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Description
I'm doing the following to check for changes to app.viewerData.state:
`
WatchJS.watch(app.viewerData, ['state'], function(){
// Viewer Visibility
if(app.viewerData.state == 1){
// Create New Viewer
console.log('Viewer State Set to: ' + app.viewerData.state);
} else {
// Close Viewer and Reset All Viewer Features
console.log('Viewer State Set to: ' + app.viewerData.state);
}
});
`
The issue I'm experiencing is getting a watch response even if the value changes from 1 to 1. I'd only want a response if the value changes from a previously different value, such as from 0 to 1, or 1 to 0. If the value changes from 1 to 1, or 0 to 0, I'd like there to be no change. How can I watch for this without using server-side code and not having to store previous values in an array? Is this ability already built into Watch.JS?