add snippet for js-mode and js2-mode

This commit is contained in:
Xiao Hanyu 2013-04-13 16:55:33 +08:00
parent 2e41e87a40
commit 9b6767f95f
17 changed files with 100 additions and 0 deletions

4
js-mode/al Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
#name : alert
# --
alert($0);

9
js-mode/author Normal file
View File

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
#name : Author
# --
/**
* Author: Johan Andersson (johan.rejeep@gmail.com)
* Created: `(format-time-string "%Y-%m-%d")`
*
* $0
*/

8
js-mode/class Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
#name : Class
# --
var ${1:name} = new Class({
initialize: function($2) {
$0
}
});

6
js-mode/com Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : comment (/* ... */)
# --
/*
* $0
*/

6
js-mode/def Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : function
# --
${1:name}: function($2) {
$0
}

6
js-mode/each Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : each
# --
${1:collection}.each(function($2) {
$0
});

6
js-mode/el Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : else
# --
else {
$0
}

6
js-mode/ev.add Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : addEvent
# --
addEvent('${1:event}', function($2) {
$0
});

4
js-mode/ev.fire Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
#name : fireEvent
# --
fireEvent('$0')

6
js-mode/f Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : anonymous function
# --
function($1) {
$0
}

6
js-mode/for Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : for
# --
for(var ${1:i} = ${2:0}; $1 < ${3:collection}.length; $1++) {
$0
}

6
js-mode/if Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : if
# --
if (${1:condition}) {
$0
}

6
js-mode/init Normal file
View File

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
#name : Constructor
# --
initialize: function($1) {
$0
}

4
js-mode/log Normal file
View File

@ -0,0 +1,4 @@
# -*- mode: snippet -*-
#name : console.log
# --
console.log($0);

8
js-mode/req.html Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
#name : html
# --
new Request.HTML({
onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
$0
}
}).${1:get}(${2:url});

8
js-mode/req.json Normal file
View File

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
#name : json
# --
new Request.JSON({
onSuccess: function(responseJSON, responseText) {
$0
}
}).${1:send}(${2:url});

1
js2-mode/.yas-parents Normal file
View File

@ -0,0 +1 @@
js-mode