jeudi 5 mai 2016

How can I run basic EmberJS tutorial code by itself?

I am going through this EmberJS tutorial. It gives you a basic overview of building an Ember application, and then gets into more specific basics. Starting at section 3 ("The Object Model"), it gives a lot of examples of writing code using Ember objects, but no straightforward instructions on how to run the basic examples. I would like to be able to run the code samples that they provide as I go along, so I can make changes / alterations and ideally gain a better understanding. I find that to be much better for retention than just reading over lots of samples.

There's a section on unit testing much deeper in the tutorial, but I'm at the very beginning here working with basic objects.

Is there a straightforward way that I could run a .js file by itself containing, for example:

Person = Ember.Object.extend({
    init() {
        var name = this.get('name');
        alert(`${name}, saying hello`);
    },

    say(thing) {
        var name = this.get('name');
        alert(`${name} says ${thing}`);
    }
});

let me = Person.create({
    name: 'My Name'
});

me.say('Hello');

...without needing a strong understanding of Ember architecture?




Aucun commentaire:

Enregistrer un commentaire