Created
December 6, 2011 08:17
-
-
Save mostlyfine/1437338 to your computer and use it in GitHub Desktop.
プラグインの単体呼び出し、オプションの指定
This file contains hidden or 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
| // | |
| // プラグイン呼び出し | |
| // | |
| $(function() { | |
| $.sample({debug:true}); | |
| }); | |
| // | |
| // プラグイン本体 | |
| // | |
| (function($) { | |
| var name_space = "sample"; | |
| $[name_space] = function(options) { | |
| var debug = function(msg) { | |
| if(options.debug && window.console && window.console.log) { | |
| window.console.log(msg); | |
| } | |
| }; | |
| options = $.extend({ | |
| debug: false | |
| }, options); | |
| debug("this is debug massage"); | |
| return this; | |
| }; | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment