Skip to content

Instantly share code, notes, and snippets.

@dlively1
Last active November 3, 2015 16:36
Show Gist options
  • Save dlively1/acda9cb3e77892bb5183 to your computer and use it in GitHub Desktop.
Save dlively1/acda9cb3e77892bb5183 to your computer and use it in GitHub Desktop.
Salesforce Lightning Component Atom Snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
# 'Console log':
# 'prefix': 'log'
# 'body': 'console.log $1'
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
'.text.xml':
'Aura Event Handler':
'prefix': 'handler'
'body': '<aura:handler name="${1:init}" value="{!${2:this}}" action="{!c.${3:doInit}}" />${4}'
'Aura Attribute':
'prefix': 'attr'
'body': '<aura:attribute name="${1}" type="${2}" default="${3}" />$4'
'SVC Icon':
'prefix':'csvg'
'body': '<c:svgIcon category="standard" size="large" name="${1}"/> $2'
'.source.js':
'call aura controller':
'prefix': 'actrl'
'body': """
var action = comp.get('c.${1}');
action.setParams({
${2}
});
action.setCallback(this, function(data) {
${3}
});
$A.enqueueAction(action);
"""
'Value Provider Get':
'prefix': 'vget'
'body': 'comp.get("v.${1}")$2'
'Value Provider Set':
'prefix': 'vset'
'body': 'comp.set("v.${1}",${2})$3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment