

<script>
mybutton = {
aInternal: 10,
aListener: function(val) {},
set text(val) {
this.aInternal = val;
this.aListener(val);
$('#mybutton').html(val);
},
get text() {
return this.aInternal;
},
registerListener: function(listener) {
this.aListener = listener;
}
}

//TextChanged
mybutton.registerListener(function(val) {
alert(JSON.stringify(this));
});

</script>

<ons-page>

	<ons-button onclick="mybutton.text = 42;" id="mybutton">Default</ons-button>

</ons-page>
