Last active
August 29, 2015 14:04
-
-
Save jmcorpdev/19f462338b51995b786a 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
/** | |
* Class Prototype ${USER} ${DATE} | |
*/ | |
/* global Utils */ | |
'use strict'; | |
(function ($, context) { | |
var ${NAME} = context.${NAME} = function () { | |
this.init.apply(this, arguments); | |
}; | |
${NAME}.prototype = { | |
constructor: ${NAME}.prototype.constructor, | |
options: { | |
}, | |
/** | |
* Constructor | |
*/ | |
init: function (element, options) { | |
this.options = $.extend(true, {}, this.options, options, Utils.getOptionsFromDom('${lowercaseName}', element)); | |
this.\$element = $(element); | |
this.create(); | |
this.events(); | |
}, | |
/** | |
* Create dom and init dom references to this | |
*/ | |
create: function () { | |
}, | |
/** | |
* Init all events | |
*/ | |
events: function () { | |
} | |
}; | |
//jquery plugin implementation | |
$.fn.${NAME} = function(options) { | |
return this.each(function() { | |
if(!$(this).data('${NAME}-plugin')) { | |
$(this).data('${NAME}-plugin', new ${NAME}(this, options)); | |
} | |
}); | |
}; | |
})(jQuery, window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment