2014-02-26 03:31:33 -05:00
|
|
|
priority -50
|
|
|
|
|
2013-03-17 15:13:47 -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"
|
2014-02-26 03:31:33 -05:00
|
|
|
'${1:${2:#thing}:${3:click}}': function(element) {
|
|
|
|
${VISUAL}$0
|
2013-03-17 15:13:47 -04:00
|
|
|
}${10:,}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet :f "Object Method"
|
2014-02-26 03:31:33 -05:00
|
|
|
${1:method_name}: function(${3:attribute}) {
|
|
|
|
${VISUAL}$0
|
2013-03-17 15:13:47 -04:00
|
|
|
}${10:,}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet :, "Object Value JS"
|
2014-02-26 03:31:33 -05:00
|
|
|
${1:value_name}: ${0:value},
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet : "Object key key: 'value'"
|
|
|
|
${1:key}: ${2:"${3:value}"}${4:, }
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet proto "Prototype (proto)"
|
2014-02-26 03:31:33 -05:00
|
|
|
${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {
|
|
|
|
${VISUAL}$0
|
|
|
|
};
|
|
|
|
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
2014-02-26 03:31:33 -05:00
|
|
|
snippet for "for (...) {...} (counting up)" b
|
|
|
|
for (var ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
|
|
|
|
${VISUAL}$0
|
2013-07-30 19:36:35 -04:00
|
|
|
}
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
2014-02-26 03:31:33 -05:00
|
|
|
snippet ford "for (...) {...} (counting down, faster)" b
|
|
|
|
for (var ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
|
|
|
|
${VISUAL}$0
|
2013-07-30 19:36:35 -04:00
|
|
|
}
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
2016-08-31 10:37:48 -04:00
|
|
|
snippet fun "function (fun)" w
|
2014-02-26 03:31:33 -05:00
|
|
|
function ${1:function_name}(${2:argument}) {
|
|
|
|
${VISUAL}$0
|
2013-03-17 15:13:47 -04:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-11-14 07:39:59 -05:00
|
|
|
snippet vf "Function assigned to var"
|
|
|
|
${1:var }${2:function_name} = function $2(${3}) {
|
|
|
|
${VISUAL}$0
|
|
|
|
};
|
2016-03-10 11:09:21 -05:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet af "Anonymous Function" i
|
|
|
|
function($1) {
|
|
|
|
${VISUAL}$0
|
|
|
|
}
|
2014-11-14 07:39:59 -05:00
|
|
|
endsnippet
|
|
|
|
|
2014-02-26 03:31:33 -05:00
|
|
|
snippet iife "Immediately-Invoked Function Expression (iife)"
|
2015-10-01 16:21:45 -04:00
|
|
|
(function(${1:window}) {
|
2014-02-26 03:31:33 -05:00
|
|
|
${VISUAL}$0
|
|
|
|
}(${2:$1}));
|
|
|
|
endsnippet
|
|
|
|
|
2013-03-17 15:13:47 -04:00
|
|
|
snippet timeout "setTimeout function"
|
2014-02-26 03:31:33 -05:00
|
|
|
setTimeout(function() {
|
|
|
|
${VISUAL}$0
|
|
|
|
}${2:.bind(${3:this})}, ${1:10});
|
|
|
|
endsnippet
|
|
|
|
|
2014-05-07 08:09:41 -04:00
|
|
|
snippet fi "for prop in obj using hasOwnProperty" b
|
2014-05-07 03:19:01 -04:00
|
|
|
for (${1:prop} in ${2:obj}){
|
|
|
|
if ($2.hasOwnProperty($1)) {
|
2014-05-07 08:10:33 -04:00
|
|
|
${VISUAL}$0
|
2014-05-07 03:19:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2014-02-26 03:31:33 -05:00
|
|
|
# Snippets for Console Debug Output
|
|
|
|
|
|
|
|
snippet ca "console.assert" b
|
|
|
|
console.assert(${1:assertion}, ${2:"${3:message}"});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cclear "console.clear" b
|
|
|
|
console.clear();
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cdir "console.dir" b
|
|
|
|
console.dir(${1:object});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cdirx "console.dirxml" b
|
|
|
|
console.dirxml(${1:object});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet ce "console.error" b
|
|
|
|
console.error(${1:"${2:value}"});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cgroup "console.group" b
|
|
|
|
console.group("${1:label}");
|
|
|
|
${VISUAL}$0
|
|
|
|
console.groupEnd();
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cgroupc "console.groupCollapsed" b
|
|
|
|
console.groupCollapsed("${1:label}");
|
|
|
|
${VISUAL}$0
|
|
|
|
console.groupEnd();
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet ci "console.info" b
|
|
|
|
console.info(${1:"${2:value}"});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cl "console.log" b
|
|
|
|
console.log(${1:"${2:value}"});
|
|
|
|
endsnippet
|
|
|
|
|
2014-05-07 03:19:01 -04:00
|
|
|
snippet cd "console.debug" b
|
|
|
|
console.debug(${1:"${2:value}"});
|
|
|
|
endsnippet
|
|
|
|
|
2014-02-26 03:31:33 -05:00
|
|
|
snippet cprof "console.profile" b
|
|
|
|
console.profile("${1:label}");
|
|
|
|
${VISUAL}$0
|
|
|
|
console.profileEnd();
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet ctable "console.table" b
|
|
|
|
console.table(${1:"${2:value}"});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet ctime "console.time" b
|
|
|
|
console.time("${1:label}");
|
|
|
|
${VISUAL}$0
|
|
|
|
console.timeEnd("$1");
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet ctimestamp "console.timeStamp" b
|
|
|
|
console.timeStamp("${1:label}");
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet ctrace "console.trace" b
|
|
|
|
console.trace();
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet cw "console.warn" b
|
|
|
|
console.warn(${1:"${2:value}"});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
# AMD (Asynchronous Module Definition) snippets
|
|
|
|
|
|
|
|
snippet def "define an AMD module"
|
|
|
|
define(${1:optional_name, }[${2:'jquery'}], ${3:callback});
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet req "require an AMD module"
|
|
|
|
require([${1:'dependencies'}], ${2:callback});
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
# vim:ft=snippets:
|