Hello,
How can one overwrite property of object, what's the syntax?
Object.defineProperty(Phaser.Text.prototype, 'text', {
get: function() {
return this._text;
},
set: function(value) {
if (value !== this._text)
{
this._text = value.toString() || '';
this.dirty = true;
if (this.parent)
{
this.updateTransform();
}
}
}
});
I would like to extend Phaser.Text, so I need to handle the moment when text is changed. Of course I can overwrite setText() method but what if by mistake in future I will access .text property?
Thanks in advance