src/wwutils.js
function(obj, propName, message) {	
	assert(typeof(propName) === 'string');
	if ( ! message) message = "Using this property indicates old/broken code.";
	// already blocked?	
	bphush = true;
	try {
		let v = obj[propName];
	} catch (err) {
		return obj;
	}
	bphush = false;
	if (obj[propName] !== undefined) {
		// already set to a value :(
		const ex = new Error("Having "+propName+" is blocked! "+message);
		if ( ! bphush) console.error(ex, this); // react can swallow stuff
		throw ex;
	}
	if ( ! Object.isExtensible(obj)) {	
		// no need -- frozen or sealed	
		return;
	}
	Object.defineProperty(obj, propName, { 
		get: function () { 
			const ex = new Error(propName+" is blocked! "+message); 
			if ( ! bphush) console.error(ex, this); // react can swallow stuff
			throw ex;					
		},
		set: function () { 
			const ex = new Error("Set "+propName+" is blocked! "+message);
			if ( ! bphush) console.error(ex, this); // react can swallow stuff
			throw ex;		
		} 
	});
	return obj;
}
function(obj, propName, message) {	
	assert(typeof(propName) === 'string');
	if ( ! message) message = "Using this property indicates old/broken code.";
	// already blocked?	
	bphush = true;
	try {
		let v = obj[propName];
	} catch (err) {
		return obj;
	}
	bphush = false;
	if (obj[propName] !== undefined) {
		// already set to a value :(
		const ex = new Error("Having "+propName+" is blocked! "+message);
		if ( ! bphush) console.error(ex, this); // react can swallow stuff
		throw ex;
	}
	if ( ! Object.isExtensible(obj)) {	
		// no need -- frozen or sealed	
		return;
	}
	Object.defineProperty(obj, propName, { 
		get: function () { 
			const ex = new Error(propName+" is blocked! "+message); 
			if ( ! bphush) console.error(ex, this); // react can swallow stuff
			throw ex;					
		},
		set: function () { 
			const ex = new Error("Set "+propName+" is blocked! "+message);
			if ( ! bphush) console.error(ex, this); // react can swallow stuff
			throw ex;		
		} 
	});
	return obj;
}
function ( obj , propName , message ) { assert ( typeof ( propName ) === 'string' ) ; if ( ! message ) message = "Using this property indicates old/broken code." ; // already blocked?	 bphush = true ; try { let v = obj [ propName ] ; } catch ( err ) { return obj ; } bphush = false ; if ( obj [ propName ] !== undefined ) { // already set to a value :( const ex = new Error ( "Having " + propName + " is blocked! " + message ) ; if ( ! bphush ) console . error ( ex , this ) ; // react can swallow stuff throw ex ; } if ( ! Object . isExtensible ( obj ) ) { // no need -- frozen or sealed	 return ; } Object . defineProperty ( obj , propName , { get : function ( ) { const ex = new Error ( propName + " is blocked! " + message ) ; if ( ! bphush ) console . error ( ex , this ) ; // react can swallow stuff throw ex ; } , set : function ( ) { const ex = new Error ( "Set " + propName + " is blocked! " + message ) ; if ( ! bphush ) console . error ( ex , this ) ; // react can swallow stuff throw ex ; } } ) ; return obj ; }
Rig obj so that any use of obj.propName will trigger an Error.
@param {!String} propName
@param {?String} message Optional helpful message, like "use foo() instead."
@returns obj (allows for chaining)
Rig obj so that any use of obj . propName will trigger an Error .