JavaScript Snippets for IMWeb
a plugin of sublime text with javascript snippets
Labels snippets
Details
Installs
- Total 8K
- Win 6K
- Mac 842
- Linux 717
Feb 15 | Feb 14 | Feb 13 | Feb 12 | Feb 11 | Feb 10 | Feb 9 | Feb 8 | Feb 7 | Feb 6 | Feb 5 | Feb 4 | Feb 3 | Feb 2 | Feb 1 | Jan 31 | Jan 30 | Jan 29 | Jan 28 | Jan 27 | Jan 26 | Jan 25 | Jan 24 | Jan 23 | Jan 22 | Jan 21 | Jan 20 | Jan 19 | Jan 18 | Jan 17 | Jan 16 | Jan 15 | Jan 14 | Jan 13 | Jan 12 | Jan 11 | Jan 10 | Jan 9 | Jan 8 | Jan 7 | Jan 6 | Jan 5 | Jan 4 | Jan 3 | Jan 2 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
JavaScript Snippets for Sublime
description
This is a JavaScript Snippets package for IMWeb team, it unifies the js snippets for IMWeb team.
The snippets of this package make a standard list in Code Guide of IMWeb team
Install
To install through Package Control, search for JavaScript Snippets for IMWeb. If you still don't have Package Control in Sublime Text, go get it. It's pure awesomeness.
If you prefer to install it manually, you can download the package and put it inside your Packages
directory. It should work but will not update automatically.
Console
[cd] console.dir
console.dir(${1:obj});
[cl] console.log
console.log(${1:obj});
EJS
[=fo] <% for %>
<% for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) { %>
${5}
<% } %>
[=if] <% if %>
<% if(${1:expr}) { %>
${2}
<% } %>
[=] <%= %>
<%${1:=} ${2:expr} %>
For
[fe] forEach
${1:myArray}.forEach(function(${2:elem}, ${3:index}) {
${4}
});
[fi] for…in
for (${1:prop} in ${2:obj}) {
if (${2:obj}.hasOwnProperty(${1:prop})) {
${3}
}
}
[for] for
for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) {
${5}
}
Function
[fn][fun] function
function ${1:functionName}(${2:arguments}) {
${3:// body...}
}
[afn] anonymous function
function(${1:arguments}) {
${2:// body...}
}
[ap] apply
apply(${1:context}, [${2:arguments}]);
[ca] call
call(${1:context}, ${2:arguments});
[iif] immediately-invoked function expression
(function(${2:win}) {
${3:// body...}
})(${1:window});
[ofn] function as a property of an object
${1:functionName}: function(${2:arguments}) {
${3:// body...}
},
If
[ife] if…else
if (${1:expr}) {
${2:// if body...}
} else {
${3}
}
Jquery
[jvt] var $this = $(this)
var \$this = \$(this);
[jct] const $this = $(this)
const \$this = \$(this);
[jve] var $var = $('var')
var \$${1} = \$('${2}');
[jce] const $var = $('var')
const \$${1} = \$('${2}');
[jvd] var d = $d.data('d')
var ${1:cid} = \$${2:this}.data('${3:cid}');
[jcd] const d = $d.data('d')
const ${1:cid} = \$${2:this}.data('${3:cid}');
[da] data()
data('${1}')
[jext] $.extend
\$.extend(${1});
[ext] extend()
extend(${1})
[jat] $.attr
\$${1:this}.attr('${2}'${3});
[at] attr()
attr('${1}'${2})
[jcss] $.css
\$${1:this}.css({${2}});
[css] css()
css({${2}})
[jwi] $.width
\$${1:this}.width(${2});
[wi] width()
width(${1})
[jhe] $.height
\$${1:this}.height(${2});
[he] height()
height(${1})
[jsh] $.show
\$${1:this}.show();
[sh] show()
show()
[jhi] $.hide
\$${1:this}.hide();
[hi] hide()
hide()
[jac] $.addClass
\$${1:this}.addClass('${2}');
[addC] addClass()
addClass('${1}')
[jrc] $.removeClass
\$${1:this}.removeClass('${2}');
[rem] removeClass()
removeClass('${1}')
[jon] $.on
\$${1:this}.on('${2:click}', ${3}function(e${4}) {
${5:// body...}
});
[on] on()
on('${1:click}', ${2}function(e${3}) {
${4:// body...}
});
[jtri] $.trigger
\$${1:doc}.trigger('${2:eventType}'${3});
[tri] trigger()
trigger('${1:eventType}'${2});
MISC
[vs] var self = this
var ${1:self} = this;
[cs] const self = this
const ${1:self} = this;
[se] self = this
self = this;
[th] that = this
that = this;
[al] alert
alert('${1:msg}');
[de] debugger
debugger;
[ret] return
return ${1:this};
[ni] new Image
new Image().src = '/${1}';
Node
[re] require
require('${1:module}');
[rea] require.async
require.async(['${1:moduleName}'], function(${2:module}) {
${3:// body...}
});
[me] module.exports
module.exports = {${1}};
Timer
[st][setT] setTimeout
setTimeout(function() {
${2:// body...}
}, ${1:delay});
[si][setI] setInterval
setInterval(function() {
${2:// body...}
}, ${1:delay});
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
History
Check Releases for detailed changelog.