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
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.dir(${1:obj});
console.log(${1:obj});
<% for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) { %>
${5}
<% } %>
<% if(${1:expr}) { %>
${2}
<% } %>
<%${1:=} ${2:expr} %>
${1:myArray}.forEach(function(${2:elem}, ${3:index}) {
${4}
});
for (${1:prop} in ${2:obj}) {
if (${2:obj}.hasOwnProperty(${1:prop})) {
${3}
}
}
for (var ${1:i} = ${2:0}, ${3:l} = ${4:arr}.length; ${1:i} < ${3:l}; ++${1:i}) {
${5}
}
function ${1:functionName}(${2:arguments}) {
${3:// body...}
}
function(${1:arguments}) {
${2:// body...}
}
apply(${1:context}, [${2:arguments}]);
call(${1:context}, ${2:arguments});
(function(${2:win}) {
${3:// body...}
})(${1:window});
${1:functionName}: function(${2:arguments}) {
${3:// body...}
},
if (${1:expr}) {
${2:// if body...}
} else {
${3}
}
var \$this = \$(this);
const \$this = \$(this);
var \$${1} = \$('${2}');
const \$${1} = \$('${2}');
var ${1:cid} = \$${2:this}.data('${3:cid}');
const ${1:cid} = \$${2:this}.data('${3:cid}');
data('${1}')
\$.extend(${1});
extend(${1})
\$${1:this}.attr('${2}'${3});
attr('${1}'${2})
\$${1:this}.css({${2}});
css({${2}})
\$${1:this}.width(${2});
width(${1})
\$${1:this}.height(${2});
height(${1})
\$${1:this}.show();
show()
\$${1:this}.hide();
hide()
\$${1:this}.addClass('${2}');
addClass('${1}')
\$${1:this}.removeClass('${2}');
removeClass('${1}')
\$${1:this}.on('${2:click}', ${3}function(e${4}) {
${5:// body...}
});
on('${1:click}', ${2}function(e${3}) {
${4:// body...}
});
\$${1:doc}.trigger('${2:eventType}'${3});
trigger('${1:eventType}'${2});
var ${1:self} = this;
const ${1:self} = this;
self = this;
that = this;
alert('${1:msg}');
debugger;
return ${1:this};
new Image().src = '/${1}';
require('${1:module}');
require.async(['${1:moduleName}'], function(${2:module}) {
${3:// body...}
});
module.exports = {${1}};
setTimeout(function() {
${2:// body...}
}, ${1:delay});
setInterval(function() {
${2:// body...}
}, ${1:delay});
- 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
Check Releases for detailed changelog.