Created
December 20, 2012 18:25
-
-
Save atypical/4347485 to your computer and use it in GitHub Desktop.
// Plugin definition
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
// Plugin definition | |
$.fn.moduleName = function( options ) { | |
var args = Array.prototype.slice.call( arguments, 1 ); | |
return this.each(function() { | |
var self = $(this), | |
moduleName = self.data('moduleName'); | |
// If we don't have a stored moduleName, make a new one and save it | |
if ( !moduleName ) { | |
moduleName = new ModuleName( self, options ); | |
self.data( 'moduleName', moduleName ); | |
} | |
if ( typeof options === 'string' ) { | |
moduleName[ options ].apply( moduleName, args ); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment