2013-11-16 19:45:48 +00:00
|
|
|
###################################################################
|
|
|
|
# Ember snippets #
|
|
|
|
###################################################################
|
|
|
|
|
2014-03-11 20:10:50 +00:00
|
|
|
priority -50
|
|
|
|
|
2013-11-16 19:45:48 +00:00
|
|
|
# Application
|
|
|
|
snippet eapp "App.Name = Ember.Application.create({});"
|
2018-12-17 11:28:27 +00:00
|
|
|
import Application from '@ember/application';
|
2013-11-16 19:45:48 +00:00
|
|
|
|
2018-12-17 11:28:27 +00:00
|
|
|
export default Application.extend({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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({
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://Properties here...}
|
2013-11-16 19:45:48 +00:00
|
|
|
});
|
|
|
|
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';
|
2013-11-16 19:45:48 +00:00
|
|
|
endsnippet
|
|
|
|
|
2018-12-17 11:28:27 +00:00
|
|
|
snippet cpro "property_name: computed('...', function() {...}),"
|
|
|
|
${1:property_name}: computed('${3:argument}', function() {
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://body...}
|
2018-12-17 11:28:27 +00:00
|
|
|
}),
|
2013-11-16 19:45:48 +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
|
2013-11-16 19:45:48 +00:00
|
|
|
|
2018-12-17 11:28:27 +00:00
|
|
|
snippet proo "property_name: observer('...', function() {...}),"
|
|
|
|
${1:property_name}: observer('${3:argument}', function() {
|
2014-03-11 20:10:50 +00:00
|
|
|
${0://body...}
|
2018-12-17 11:28:27 +00:00
|
|
|
}),
|
2013-11-16 19:45:48 +00:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
# vim:ft=snippets:
|