Last month, @ukelilybee spoke at the DublinJS conference about the use of Ember.js at Intercom
The title was: "A People's History of Ember"
or why choosing Ember for your front-end framework in 2019 should be considered a crime against coding.
This presentation is entitled:
Exhibit A for the Prosecution
export default Controller.extend(Noti, Modal, InputErrorParser,{
ajax: inject('ajax'),
userService: inject('user'),
i18n: inject(),
/* ... many lines of code abridged ... */
obsShowUserForm: observer('userService.controllerUserId', function(){
if(!isBlank(this.userService.controllerUserId)){
this.set('selection', 'userForm')
this.set('selectedUserId', this.userService.controllerUserId)
}
}).on('init'),
obsUserModel: observer('selectedUserId', function(){
if(!isBlank(this.selectedUserId) && this.selection === 'userForm'){
this.store.findRecord('user', this.selectedUserId).then((fullUser) => {
this.set('userKycRejected', fullUser.kycRejected)
this.set('userKyc', fullUser.kyc)
this.set('selection', 'userForm')
this.set('userModel', new Changeset(fullUser, lookupValidator(UserValidation),UserValidation))
})
}
}),
obsCompanyEmailTerm: observer('companyTerm', 'emailTerm', function () {
this.set('page', 0);
this.refreshList(500);
}),
obsSelection: observer('selection', 'countryTerm', function () {
if(this.selection !== 'userForm'){
this.set('page', 0);
this.refreshList(0);
}
}),
usersEmpty: computed('selection', '{customers,pending,rejected}List', function () {
if(this.selection === 'userForm'){
return false
}else{
const list = this.get(`${this.selection}List`);
return isEmpty(list) || isEmpty(list.user)
}
}),
Exhibit B for the Prosecution
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
import { inject } from '@ember/service';
import { Promise } from 'rsvp';
import Route from '@ember/routing/route';
import $ from 'jquery'
export default Route.extend(ApplicationRouteMixin,{
session: inject('session'),
loginedUser: inject('landlord'),
wp: inject('welcome-pack'),
beforeModel: function(transition){
$(document).on('click', function(event){
if(!$(event.target).hasClass('drop-down')){
$('.drop-down').removeClass('show');
}else{
$('.drop-down').not($(this)).removeClass('show');
$(event.target).addClass('show');
}
})
this._super(transition);
},
model(){
return new Promise((reslove, reject) => {
this.store.findAll('welcome-pack').then((welcomePack) => {
this.wp.setWp(welcomePack.objectAt(0))
document.title = this.get('wp.wp.tenantName')
reslove()
}, (err) => {
reject(err)
})
});
}
});
export default DS.Model.extend({
companyLogo: DS.attr('string'), //<- had to add this line.
tenantName: DS.attr('string'),
actualCompanyLogo: //<- and this line
computed('companyLogo', function(){
return isBlank(this.companyLogo)
? "/assets/images/logo-placeholder.png"
: this.companyLogo;
})
})
Testimony
"Before it's easy in Ember, you have to learn Ember."
Expert Witness: https://2017.stateofjs.com/2017/front-end/results
Expert Witness: Google Trends