2014-03-11 20:10:50 +00:00
|
|
|
priority -50
|
|
|
|
|
2012-08-17 03:41:25 +00: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"
|
2014-03-11 20:10:50 +00:00
|
|
|
'${1:${2:#thing}:${3:click}}': function(element) {
|
|
|
|
${VISUAL}$0
|
2012-08-17 03:41:25 +00:00
|
|
|
}${10:,}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet :f "Object Method"
|
2014-03-11 20:10:50 +00:00
|
|
|
${1:method_name}: function(${3:attribute}) {
|
|
|
|
${VISUAL}$0
|
2012-08-17 03:41:25 +00:00
|
|
|
}${10:,}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet :, "Object Value JS"
|
2014-03-11 20:10:50 +00:00
|
|
|
${1:value_name}: ${0:value},
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet : "Object key key: 'value'"
|
|
|
|
${1:key}: ${2:"${3:value}"}${4:, }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet proto "Prototype (proto)"
|
2014-03-11 20:10:50 +00:00
|
|
|
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
|
|
|
${VISUAL}$0
|
|
|
|
};
|
|
|
|
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
2016-10-02 11:37:21 +00:00
|
|
|
snippet fun "function (fun)" w
|
2014-03-11 20:10:50 +00:00
|
|
|
function ${1:function_name}(${2:argument}) {
|
|
|
|
${VISUAL}$0
|
2012-08-17 03:41:25 +00:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2015-01-18 12:58:28 +00:00
|
|
|
snippet vf "Function assigned to var"
|
2017-02-11 13:01:38 +00:00
|
|
|
${1:var }${2:function_name} = function $2($3) {
|
2014-03-11 20:10:50 +00:00
|
|
|
${VISUAL}$0
|
2015-01-18 12:58:28 +00:00
|
|
|
};
|
2016-03-14 10:04:57 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet af "Anonymous Function" i
|
|
|
|
function($1) {
|
|
|
|
${VISUAL}$0
|
|
|
|
}
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
2015-01-18 12:58:28 +00:00
|
|
|
snippet iife "Immediately-Invoked Function Expression (iife)"
|
2015-12-08 13:20:04 +00:00
|
|
|
(function(${1:window}) {
|
2014-03-11 20:10:50 +00:00
|
|
|
${VISUAL}$0
|
2015-01-18 12:58:28 +00:00
|
|
|
}(${2:$1}));
|
2012-08-17 03:41:25 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet timeout "setTimeout function"
|
2014-03-11 20:10:50 +00:00
|
|
|
setTimeout(function() {
|
|
|
|
${VISUAL}$0
|
|
|
|
}${2:.bind(${3:this})}, ${1:10});
|
|
|
|
endsnippet
|
|
|
|
|
2014-07-02 11:18:18 +00:00
|
|
|
snippet fi "for prop in obj using hasOwnProperty" b
|
|
|
|
for (${1:prop} in ${2:obj}){
|
|
|
|
if ($2.hasOwnProperty($1)) {
|
|
|
|
${VISUAL}$0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2012-08-17 03:41:25 +00:00
|
|
|
# vim:ft=snippets:
|