Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Glimmer ✨ as a Gateway to Ember 🐹

Glimmer ✨ as a Gateway to Ember 🐹

Talk presented at EmberCamp London.

Robert Jackson

July 11, 2017
Tweet

More Decks by Robert Jackson

Other Decks in Programming

Transcript

  1. 3

  2. 4

  3. 5

  4. 6

  5. 7

  6. 15 Glimmer.js import Component from '@glimmer/component'; export default class Contact

    extends Component { get name() { return `Doctor Who`; } }
  7. 16 Glimmer.js import Component from '@glimmer/component'; export default class Contact

    extends Component { @tracked('args') get name() { return `${this.args.first} ${this.args.last}`; } }
  8. 17 Glimmer.js import Component from '@glimmer/component'; export default class Contact

    extends Component { args: { first: string; last: string; }; @tracked('args') get name() { return `${this.args.first} ${this.args.last}`; } }
  9. 18 Glimmer.js ember new test-webapp -b @glimmer/blueprint cd test-webapp ember

    install ember-service-worker ember install ember-service-worker-asset-cache ember install ember-service-worker-cache-fallback ember install ember-web-app ember serve -prod
  10. 24 Ember // ...snip... test('it “just” works?!?!', function(assert) { class

    TestService extends Ember.Service {} let owner = getOwner(this); owner.register('service:test', TestService); let instance =owner.lookup('service:test'); assert.ok(instance instanceof TestService); assert.ok(instance instanceof Ember.Service); });
  11. 26 Ember // ...snip... test('it renders', function(assert) { class XFoo

    extends Ember.Component {} this.register('component:x-foo', XFoo); this.register('template:components/x-foo', hbs`hi!`); this.render(hbs`{{x-foo}}`); assert.equal(this.$().text().trim(), 'hi!'); });
  12. 29 Ember import Component from '@ember/component'; import { computed }

    from 'ember-decorators/object'; export default class extends Component { @computed('first', 'last') name(first, last) { return `${first} ${last}`; } }
  13. 30 Ember import Component from '@ember/component'; import { action }

    from 'ember-decorators/object'; export default class extends Component { @action update() { // ...snip... } }
  14. 31 Ember import Component from '@ember/component'; import { service }

    from 'ember-decorators/service; export default class extends Component { @service i18n }
  15. 33