Created
December 11, 2012 00:53
-
-
Save erzr/4254777 to your computer and use it in GitHub Desktop.
Javascript Prototype Pattern with Default Options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Slideshow = (function($) { | |
function Slideshow(options) { | |
var defaults = { | |
timeout: 0.5, | |
selector: '.content' | |
}; | |
this.options = $.extend(defaults, options); | |
}; | |
Slideshow.prototype.alertSelector = function() { | |
console.log(this.options.timeout); | |
}; | |
return Slideshow; | |
})(jQuery); | |
var slideshow = new Slideshow({ | |
timeout: 0.9 | |
}); | |
slideshow.alertSelector(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment