vimrc/sources_non_forked/vim-snippets/UltiSnips/javascript-ember.snippets

102 lines
2.3 KiB
Text
Raw Normal View History

###################################################################
# Ember snippets #
###################################################################
priority -50
# Application
snippet eapp "App.Name = Ember.Application.create({});"
2018-12-17 11:28:27 +00:00
import Application from '@ember/application';
2018-12-17 11:28:27 +00:00
export default Application.extend({
${0://Properties here...}
});
endsnippet
2018-12-17 11:28:27 +00:00
# Models
snippet emod "import DS from 'ember-data';"
import DS from 'ember-data';
export default DS.Model.extend({
${0://Properties here...}
});
endsnippet
# Controller
2018-12-17 11:28:27 +00:00
snippet econtroller "import Controller from '@ember/controller';"
import Controller from '@ember/controller';
export default Controller.extend({
${0://Properties here...}
});
endsnippet
# Route
2018-12-17 11:28:27 +00:00
snippet eroute "import Route from '@ember/routing/route';"
import Route from '@ember/routing/route';
export default Route.extend({
${0://Properties here...}
});
endsnippet
2018-12-17 11:28:27 +00:00
# Component
snippet ecomponent "import Component from '@ember/component';"
import Component from '@ember/component';
export default Component.extend({
${0://Properties here...}
});
endsnippet
# Object
2018-12-17 11:28:27 +00:00
snippet eobj "import EmberObject from '@ember/object';"
import EmberObject from '@ember/object';
export default EmberObject.extend({
${0://Properties here...}
});
endsnippet
# Mixin
snippet emix "App.MixinName = Ember.Model.extend({...});"
2018-12-17 11:28:27 +00:00
import Mixin from '@ember/object/mixin';
export default Mixin.create({
${0://Properties here...}
});
endsnippet
# Ember getter and setter
snippet eget "this.get('property');"
${1:this}.get('${2:property}');
endsnippet
snippet eset "this.set('property', value);"
${1:this}.set('${2:property}', ${3:value});
endsnippet
2018-12-17 11:28:27 +00:00
# Computed properties
snippet cproimport "import { computed } from '@ember/object';"
import { computed } from '@ember/object';
endsnippet
2018-12-17 11:28:27 +00:00
snippet cpro "property_name: computed('...', function() {...}),"
${1:property_name}: computed('${3:argument}', function() {
${0://body...}
2018-12-17 11:28:27 +00:00
}),
endsnippet
2018-12-17 11:28:27 +00:00
# Observers
snippet prooimport "import { observer } from '@ember/object';"
import { observer } from '@ember/object';
endsnippet
2018-12-17 11:28:27 +00:00
snippet proo "property_name: observer('...', function() {...}),"
${1:property_name}: observer('${3:argument}', function() {
${0://body...}
2018-12-17 11:28:27 +00:00
}),
endsnippet
# vim:ft=snippets: