Skip to content

Instantly share code, notes, and snippets.

@Saneyan
Created December 19, 2011 22:46
Show Gist options
  • Select an option

  • Save Saneyan/1499260 to your computer and use it in GitHub Desktop.

Select an option

Save Saneyan/1499260 to your computer and use it in GitHub Desktop.
/**
* Auto Update
* These anonymous functions extends specific object automatically.
*/
(function( Update ){
try{
// Succeed to wic properties and methods.
// But some of them are overridden.
Update.prototype = wic;
} catch( e ){
// For undefined object 'wic'
Update.prototype = {};
}
// Set as a new object.
wic = new Update();
})
/**
* Constructor.
*/
(function(){
this.say = function(){
alert( 'Hello, world!' );
};
});
wic.say(); // Hello, world!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment