The default JavaScript snippets in the Atom.io editor
|
Trigger
|
Content
|
|
log
|
console.log($1);$0
|
|
warn
|
console.warn($1);$0
|
|
error
|
console.error($1);$0
|
|
f
|
function ($1) {\n\t$2\n}
|
|
fun
|
function ${1:function_name}(${2:argument}) {\n\t${0:// body...}\n}
|
|
iife
|
(function() {\n\t${1:"use strict";\n}\t$2\n}());
|
|
get
|
getElementsByTagName(${1:'${2:tagName}'})
|
|
qs
|
querySelector(${1:'${2:query}'})
|
|
qsa
|
querySelectorAll(${1:'${2:query}'})
|
|
if
|
if (${1:true}) {\n\t$2\n}
|
|
else
|
{\n\t$1\n}
|
|
ife
|
if (${1:true}) {\n\t$2\n} else {\n\t$3\n}
|
|
switch
|
switch (${1:expression}) {\n\tcase ${2:expression}:\n\t\t$4\n\t\tbreak;$5\n\tdefault:\n\t\t$3\n}
|
|
:
|
${1:key}: ${2:"${3:value}"}${4:, }
|
|
:f
|
${1:method_name}: function (${2:attribute}) {\n\t$3\n}${4:,}
|
|
interval
|
setInterval(${2:function () {\n\t$3\n}}, ${1:10});
|
|
timeout
|
setTimeout(${2:function () {\n\t$3\n}}, ${1:10});
|
|
do
|
do {\n\t$2\n} while (${1:true});
|
|
for
|
for (var ${2:i} = 0; ${2:i} < ${1:array}.length; ${2:i}++) {\n\t${1:array}[${2:i}]$3\n}
|
|
while
|
while (${1:true}) {\n\t$2\n}
|
|
forin
|
for (${1:variable} in ${2:object}) {\n\t${5:if (${3:object}.hasOwnProperty(${4:variable})) {\n\t\t$6\n\t}}\n}
|
|
try
|
try {\n\t${1:statements}\n} catch (${2:variable}) {\n\t${3:statements}\n}${4: finally {\n\t${5:statements}\n}}
|
|
prom
|
new Promise(function(resolve, reject) {\n\t$1\n});$0
|
|
proto
|
${1:class_name}.prototype.${2:method_name} = function (${3:first_argument}) {\n\t${0:// body...}\n};
|
|
/**
|
/**/\n $1\n /$0
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.