Skip to content

Instantly share code, notes, and snippets.

@coreymcollins
Created October 10, 2018 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcollins/53fce21f45c03d68b98086f78458881c to your computer and use it in GitHub Desktop.
Save coreymcollins/53fce21f45c03d68b98086f78458881c to your computer and use it in GitHub Desktop.
VS Code JS/jQuery Snippetes
"WDS jQuery Block": {
"prefix": "jq",
"body": [
"/**",
" * ${1:Name File} Script.",
" */",
"window.WDS${2:Name Object}Object = {};",
"( function( window, \\$, app ) {",
"",
" // Constructor.",
" app.init = function() {",
" app.cache();",
"",
" if ( app.meetsRequirements() ) {",
" app.bindEvents();",
" }",
" };",
"",
" // Cache all the things.",
" app.cache = function() {",
" app.\\$c = {",
" window: \\$(window),",
" ${3:Selector}: \\$( '${4:div}' ),",
" };",
" };",
"",
" // Combine all events.",
" app.bindEvents = function() {",
" app.\\$c.window.on( 'load', app.do${5:Do Function} );",
" };",
"",
" // Do we meet the requirements?",
" app.meetsRequirements = function() {",
" return app.\\$c.${3:Selector}.length;",
" };",
"",
" // ${1:Name File}.",
" app.do${5:Do Function} = function() {",
"",
" // ${6: Do Stuff}"
" };",
"",
" // Engage!",
" \\$( app.init );",
"",
"}( window, jQuery, window.WDS${2:Name Object}Object ) );"
"",
],
"description": "Javascript - WDS jQuery"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment