var Block = require('../Block')
var proto = require('proto')

module.exports = proto(Block, function(superclass) {

	// static variables

    this.name = 'TextArea'

	this.init = function(label) {
        this.domNode = document.createElement("textarea") // do this before calling the superclass constructor so that an extra useless domNode isn't created inside it
        superclass.init.call(this) // superclass constructor
		this.label = label
	}


	// instance properties


    Object.defineProperty(this, 'val', {
        // returns the value of the Option
        get: function() {
            return this.domNode.value
        },

        // sets the value of the Option
        set: function(value) {
            if(this.val === value) return; // do nothing if there's no change

            this.domNode.value = value
            this.emit('change')
        }
    })
});
