Guest User

Untitled

a guest
Aug 10th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. function Slideshow(options) {
  2.  
  3. // The defaults, if user didn't provide values
  4. var defaults = {
  5. openSpeed : 1000,
  6. closeSpeed : 1000,
  7. animationFunction : "linear",
  8. matt: "bob"
  9. };
  10.  
  11. // Function that takes options as does something with it
  12. function init(options) {
  13. console.info(options);
  14. }
  15.  
  16. // Takes user proivded
  17. function combine_options(options) {
  18. for ( option in defaults ) {
  19. if ( typeof options[option] == "undefined" ) {
  20. options[option] = defaults[option]
  21. }
  22. } return options;
  23. }
  24.  
  25. init(combine_options(options));
  26.  
  27. }
  28.  
  29. var my_slideshow = new Slideshow({
  30. openSpeed: 2000
  31. });
Add Comment
Please, Sign In to add comment