102 lines
2.3 KiB
Text
102 lines
2.3 KiB
Text
|
###################################################################
|
||
|
# Ember snippets #
|
||
|
###################################################################
|
||
|
|
||
|
priority -50
|
||
|
|
||
|
# Application
|
||
|
snippet eapp "App.Name = Ember.Application.create({});"
|
||
|
import Application from '@ember/application';
|
||
|
|
||
|
export default Application.extend({
|
||
|
${0://Properties here...}
|
||
|
});
|
||
|
endsnippet
|
||
|
|
||
|
# Models
|
||
|
snippet emod "import DS from 'ember-data';"
|
||
|
import DS from 'ember-data';
|
||
|
|
||
|
export default DS.Model.extend({
|
||
|
${0://Properties here...}
|
||
|
});
|
||
|
endsnippet
|
||
|
|
||
|
# Controller
|
||
|
snippet econtroller "import Controller from '@ember/controller';"
|
||
|
import Controller from '@ember/controller';
|
||
|
|
||
|
export default Controller.extend({
|
||
|
${0://Properties here...}
|
||
|
});
|
||
|
endsnippet
|
||
|
|
||
|
# Route
|
||
|
snippet eroute "import Route from '@ember/routing/route';"
|
||
|
import Route from '@ember/routing/route';
|
||
|
|
||
|
export default Route.extend({
|
||
|
${0://Properties here...}
|
||
|
});
|
||
|
endsnippet
|
||
|
|
||
|
# Component
|
||
|
snippet ecomponent "import Component from '@ember/component';"
|
||
|
import Component from '@ember/component';
|
||
|
|
||
|
export default Component.extend({
|
||
|
${0://Properties here...}
|
||
|
});
|
||
|
endsnippet
|
||
|
|
||
|
# Object
|
||
|
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({...});"
|
||
|
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
|
||
|
|
||
|
# Computed properties
|
||
|
snippet cproimport "import { computed } from '@ember/object';"
|
||
|
import { computed } from '@ember/object';
|
||
|
endsnippet
|
||
|
|
||
|
snippet cpro "property_name: computed('...', function() {...}),"
|
||
|
${1:property_name}: computed('${3:argument}', function() {
|
||
|
${0://body...}
|
||
|
}),
|
||
|
endsnippet
|
||
|
|
||
|
# Observers
|
||
|
snippet prooimport "import { observer } from '@ember/object';"
|
||
|
import { observer } from '@ember/object';
|
||
|
endsnippet
|
||
|
|
||
|
snippet proo "property_name: observer('...', function() {...}),"
|
||
|
${1:property_name}: observer('${3:argument}', function() {
|
||
|
${0://body...}
|
||
|
}),
|
||
|
endsnippet
|
||
|
|
||
|
# vim:ft=snippets:
|