Created
July 10, 2011 04:46
-
-
Save jondavidjohn/1074281 to your computer and use it in GitHub Desktop.
Javascript Component Starting point
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 component = (function($){ | |
var default_options = { | |
array_option : [], | |
string_option : "default" | |
}; | |
return { | |
other_function: function(args) { | |
//store context | |
var self = this; | |
}, | |
init: function(options) { | |
var self = this; | |
self.o = $.extend(default_options, options); | |
/*** | |
* Initialize component | |
*/ | |
self.other_function(args); | |
} | |
}; | |
})(jQuery); |
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
<script src="jquery.js"></script> | |
<script src="component.js"></script> | |
<script type="text/javascript"> | |
component.init({ | |
array_option : ["1","2"], | |
string_option : "This is a string being put into my component" | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment