1
0
Fork 0
mirror of synced 2024-11-23 01:05:34 -05:00
ultimate-vim/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets

73 lines
1.4 KiB
Text
Raw Normal View History

2012-08-16 23:41:25 -04:00
###########################################################################
# TextMate Snippets #
###########################################################################
snippet get "Get Elements"
getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
endsnippet
snippet '':f "object method string"
'${1:${2:#thing}:${3:click}}': function(element){
$0
}${10:,}
endsnippet
snippet :f "Object Method"
${1:method_name}: function(${3:attribute}){
$0
}${10:,}
endsnippet
snippet :, "Object Value JS"
${1:value_name}:${0:value},
endsnippet
snippet : "Object key key: 'value'"
${1:key}: ${2:"${3:value}"}${4:, }
endsnippet
snippet proto "Prototype (proto)"
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) ,,{
${0:// body...}
};
endsnippet
snippet for "for (...) {...} (faster)"
for (var ${2:i} = ${1:Things}.length - 1; $2 >= 0; $2--){
${3:$1[$2]}$0
};
endsnippet
snippet for "for (...) {...}"
for (var ${2:i}=0; $2 < ${1:Things}.length; $2++) {
${3:$1[$2]}$0
};
endsnippet
snippet fun "function (fun)"
function ${1:function_name} (${2:argument}) {
${0:// body...}
}
endsnippet
2013-07-17 19:06:05 -04:00
# for one line if .. else you usually use a ? b : c
2012-08-16 23:41:25 -04:00
snippet ife "if ___ else"
2013-07-17 19:06:05 -04:00
if (${1}) {
{$2}
} else {
{$3}
};
2012-08-16 23:41:25 -04:00
endsnippet
snippet if "if"
2013-07-17 19:06:05 -04:00
if (${1}) {
{$2}
};
2012-08-16 23:41:25 -04:00
endsnippet
snippet timeout "setTimeout function"
setTimeout(function() {$0}${2:}, ${1:10});
endsnippet
# vim:ft=snippets: