Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

How does UI5 Hides Object's prototype property ? !!!!!!!

$
0
0

Hey All,

 

I'm just wondering how UI5 hides Javascript Object's prototype property !! I was just playing around with UI5 controls and encountered this.

 

  • Created a method 'Move' in the prototype of sap.m.Button.
  • Created a new instance for the Button 'oButton'.
  • oButton instance doesn't have the method Move which it is supposed to have.

 

sap.m.Button.prototype.Move=function(){
  console
.log('Move');
}
var oButton =new sap.m.Button({text:"Hello"});
oButton
.Move();// throws undefined function!


The Most interesting thing is the same code when executed in Browser console, works like a charm !

 

How is this possible ?


JS Bin - Collaborative JavaScript Debugging</title> <link rel="icon" href="http://static.jsbin.…


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>