A snippet pack to make you more productive working with JavaScript. Based on theAtom snippets. This extension ships a bunch of useful code snippets for the JavaScript editor. Get an overview from theCode Snippet Manager in Visual Studio located under the Tools top level menu. Here's the full list of all the snippets: Console[cd] console.dirconsole.dir(${1:obj}); [ce] console.errorconsole.error($end$); [ci] console.infoconsole.info($end$); [cl] console.logconsole.log($end$); [cw] console.warnconsole.warn($end$); [de] debuggerdebugger; DOM[ae] addEventListener$document$.addEventListener('$event$', function(e) { $end$}); [ac] appendChild$document$.appendChild($elem$); [rc] removeChild$document$.removeChild($elem$); [cel] createElement$document$.createElement($elem$); [cdf] createDocumentFragment$document$.createDocumentFragment($elem$); [ca] classList.add$document$.classList.add('$class$'); [ct] classList.toggle$document$.classList.toggle('$class$'); [cr] classList.remove$document$.classList.remove('$class$'); [gi] getElementById$document$.getElementById('$id$'); [gc] getElementsByClassName$document$.getElementsByClassName('$class$'); [gt] getElementsByTagName$document$.getElementsByTagName('$tag$'); [ga] getAttribute$document$.getAttribute('$attr$'); [sa] setAttribute$document$.setAttribute('$attr$', $value$); [ra] removeAttribute$document$.removeAttribute('$attr$'); [ih] innerHTML$document$.innerHTML = '$elem$'; [tc] textContent$document$.textContent = '$content$'; [qs] querySelector$document$.querySelector('$selector$'); [qsa] querySelectorAll$document$.querySelectorAll('$selector$'); Loop[fe] forEach$myArray$.forEach(function($item$) { $end$}); Function[afn] anonymous functionfunction($arguments$) { $end$} [pr] prototype$object$.prototype.$methodName$ = function($arguments$) { $end$} [call] function call$methodName$.call($context$, $arguments$) [apply] function apply$methodName$.apply($context$, [$arguments$]) [ofn] function as a property of an object$functionName$: function($arguments$) { $end$} JSON[jp] JSON.parseJSON.parse($object$); [js] JSON.stringifyJSON.stringify($object$); Timer[si] setIntervalsetInterval(function() { $end$}, $delay$); [st] setTimeoutsetTimeout(function() { $end$}, $delay$); Misc[us] use strict'use strict'; [al] alertalert('$message$'); [co] confirmconfirm('$message$'); [pm] promptprompt('$message$');
|