This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Snoops on an object, monitors all attempts to access and set properties | |
* @param {Object} obj - the object to monitor | |
* @param {string[]=} props - list of properties to watch, watches all properties by default | |
* @param {Function=} onset - callback when the property is set (newValue is passed) | |
* @param {Function=} onget - callback when the property is accessed | |
* @param verbose | |
*/ | |
function snoopProperty(obj, props = [], onset = (val) => null, onget = () => null, verbose = true) { |
NewerOlder