Last active
August 29, 2015 14:01
-
-
Save vergissberlin/c26076d39469ca4829a6 to your computer and use it in GitHub Desktop.
JavaScript: Scaffold for jQuery plugin programming.
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
/** | |
* jQuery Plugin | |
* | |
* @category JavaScript | |
* @package PROJECT | |
* @author Excellent Developer <[email protected]> | |
* @license https://netresearch.de/license | |
* @version 0.0.1 | |
* requires jquery 2.1.1 | |
*/ | |
(function ($, window, document) { | |
$.fn.myPlugin = function(options) { | |
var helper, handler, def, conf; | |
// Configuration with defaults | |
conf = { | |
// Switches | |
showSomething: false, | |
// Templates | |
}; | |
conf = $.extend(settings, options ); | |
// Default configuration | |
def = { | |
$self: $(this), | |
$window: $(window), | |
$document: $(document) | |
}; | |
helper = { | |
calculateSomething: function(value) { | |
return value + value; | |
} | |
} | |
handler = { | |
/** | |
* Constructor | |
*/ | |
init: function() { | |
// return self for chaining | |
return this; | |
} | |
} | |
// Call constructor | |
handler.init(); | |
}; | |
}( jQuery, window, document )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment