export class Pipe<ValueType>
{
	private changeCallbacks: ((newValue: ValueType) => void)[] = []; 
	
	constructor(private value: ValueType) {
	}
	
	get() { return this.value; }
	
	set(value: ValueType)
	{
		this.value = value;
		for(let callback of this.changeCallbacks) {
			callback(value);
		}
	}
	
	onChange(callback: (newValue: ValueType) => void) {
		this.changeCallbacks.push(callback);
	}
}
