JavaScript Snippets for Atom ![Build Status](https://camo.githubusercontent.com/62d62f5cb1fd92ac78a1841eac48d22864c523774cda16a4d64a4a2515051b08/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f7a656e6f726f6368612f61746f6d2d6a6176617363726970742d736e6970706574732e7376673f6272616e63683d6d6173746572)
Go to Atom > Preferences...
then search for JavaScript Snippets in Packages tab.
$ 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.log(${1:obj});
console.warn(${1:obj});
${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(${2:elem});
${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(window, document, undefined) {
${0:// body...}
})(window, document);
${1:methodName}.call(${2:context}, ${3:arguments})
${1:methodName}.apply(${2:context}, [${3:arguments}])
${1:functionName}: function(${2:arguments}) {
${3:// body...}
}
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}');
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