1
0
Fork 0
mirror of synced 2024-12-22 23:18:56 -05:00
ultimate-vim/sources_non_forked/vim-snippets/UltiSnips/javascript.snippets
2017-02-11 14:01:38 +01:00

75 lines
1.5 KiB
Text

priority -50
###########################################################################
# 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) {
${VISUAL}$0
}${10:,}
endsnippet
snippet :f "Object Method"
${1:method_name}: function(${3:attribute}) {
${VISUAL}$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}) {
${VISUAL}$0
};
endsnippet
snippet fun "function (fun)" w
function ${1:function_name}(${2:argument}) {
${VISUAL}$0
}
endsnippet
snippet vf "Function assigned to var"
${1:var }${2:function_name} = function $2($3) {
${VISUAL}$0
};
endsnippet
snippet af "Anonymous Function" i
function($1) {
${VISUAL}$0
}
endsnippet
snippet iife "Immediately-Invoked Function Expression (iife)"
(function(${1:window}) {
${VISUAL}$0
}(${2:$1}));
endsnippet
snippet timeout "setTimeout function"
setTimeout(function() {
${VISUAL}$0
}${2:.bind(${3:this})}, ${1:10});
endsnippet
snippet fi "for prop in obj using hasOwnProperty" b
for (${1:prop} in ${2:obj}){
if ($2.hasOwnProperty($1)) {
${VISUAL}$0
}
}
endsnippet
# vim:ft=snippets: