JavaScript Snippets for Atom
Go to Atom > Preferences...
then search for JavaScript Snippets in Packages tab.
Restart atom.
$ cd ~/.atom/packages
$ git clone https://github.com/zenorocha/atom-javascript-snippets.git
$ cd atom-javascript-snippets
$ apm install
$ apm link
console.dir(${1:obj});
console.error(${1:obj});
console.info(${1:obj});
console.log(${1:obj});
console.warn(${1:obj});
debugger;
${1:document}.addEventListener('${2:event}', function(e) {
${0:// body...}
});
${1:document}.appendChild(${2:elem});
${1:document}.removeChild(${2:elem});
${1:document}.createElement(${2:elem});
${1:document}.createDocumentFragment();
${1:document}.classList.add('${2:class}');
${1:document}.classList.toggle('${2:class}');
${1:document}.classList.remove('${2:class}');
${1:document}.getElementById('${2:id}');
${1:document}.getElementsByClassName('${2:class}');
${1:document}.getElementsByTagName('${2:tag}');
${1:document}.getAttribute('${2:attr}');
${1:document}.setAttribute('${2:attr}', ${3:value});
${1:document}.removeAttribute('${2:attr}');
${1:document}.innerHTML = '${2:elem}';
${1:document}.textContent = '${2:content}';
${1:document}.querySelector('${2:selector}');
${1:document}.querySelectorAll('${2:selector}');
${1:myArray}.forEach(function(${2:elem}) {
${0:// body...}
});
for (${1:prop} in ${2:obj}) {
if (${2:obj}.hasOwnProperty(${1:prop})) {
${0:// body...}
}
}
function ${1:methodName} (${2:arguments}) {
${0:// body...}
}
function(${1:arguments}) {
${0:// body...}
}
${1:ClassName}.prototype.${2:methodName} = function(${3:arguments}) {
${0:// body...}
}
(function(${1:window}, ${2:document}) {
${0:// body...}
})(${1:window}, ${2:document});
${1:methodName}.call(${2:context}, ${3:arguments})
${1:methodName}.apply(${2:context}, [${3:arguments}])
${1:functionName}: function(${2:arguments}) {
${3:// body...}
}
JSON.parse(${1:obj});
JSON.stringify(${1:obj});
setInterval(function() {
${0:// body...}
}, ${1:delay});
setTimeout(function() {
${0:// body...}
}, ${1:delay});
assert.equal(${1:actual}, ${2:expected});
assert.deepEqual(${1:actual}, ${2:expected});
assert.notEqual(${1:actual}, ${2:expected});
module.exports = ${1:name};
process.exit(${1:code});
require('${1:module}');
describe('${1:description}', function() {
${0:// body...}
});
it('${1:description}', function(done) {
${0:// body...}
});
it('${1:description}', function() {
${0:// body...}
});
it('${1:description}');
'use strict';
alert('${1:msg}');
confirm('${1:msg}');
prompt('${1:msg}');
- 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 Release list.
MIT License © Zeno Rocha