Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

OOP: delegate • Now we Exciting JavaScript - Part I

8,304 views

Published on

OOP: delegate
• Now we can write a generic delegate:
var delegate = (function(){
function temp(){} // it’ll hold a prototype reference
return function(obj){
temp.prototype = obj; // saving a prototype
var t = new temp(); // new object is delegated
temp.prototype = null; // avoid a memory leak
return t;
};
})();



40

Published in: Technology

×