lib/term_state.js
function setterFor(objName) {
	return function(name, value) {
		if(this["_"+objName+"sUsed"] === true) {
			this["_"+objName+"s"] = myUtil.extend({}, this["_"+objName+"s"]);
			this["_"+objName+"sUsed"] = false;
		}
		var obj = this["_"+objName+"s"];

		if(!(name in obj))
			throw new Error("Unknown "+objName+" `"+name+"`");
		this.emit(objName+"change", name, value, obj[name]);
		obj[name] = value;
	};
}
function setterFor(objName) {
	return function(name, value) {
		if(this["_"+objName+"sUsed"] === true) {
			this["_"+objName+"s"] = myUtil.extend({}, this["_"+objName+"s"]);
			this["_"+objName+"sUsed"] = false;
		}
		var obj = this["_"+objName+"s"];

		if(!(name in obj))
			throw new Error("Unknown "+objName+" `"+name+"`");
		this.emit(objName+"change", name, value, obj[name]);
		obj[name] = value;
	};
}
function setterFor ( objName ) { return function ( name , value ) { if ( this [ "_" + objName + "sUsed" ] === true ) { this [ "_" + objName + "s" ] = myUtil . extend ( { } , this [ "_" + objName + "s" ] ) ; this [ "_" + objName + "sUsed" ] = false ; } var obj = this [ "_" + objName + "s" ] ; if ( ! ( name in obj ) ) throw new Error ( "Unknown " + objName + " `" + name + "`" ) ; this . emit ( objName + "change" , name , value , obj [ name ] ) ; obj [ name ] = value ; } ; }
Creates setter for a specific property used on attributes, modes, and meta
properties.

If the object defines a property _fooUsed, copy on write is enabled. This
makes sure that the object is is copied before any changes are made.
This makes it possible to reference the object from other context without
copying it every time. This reduces memory consumption in some cases.

@private
Creates setter for a specific property used on attributes modes and meta properties .