riot/examples

ES6 sample is broken

ilanc opened this issue · 2 comments

ilanc commented

The ES6 example seems to be broken both on plunker and when I run locally. I'm still quite new so not sure where to look. The compiler seems to be creating invalid javascript i.e. es.tag.js has:

riot.tag2('es-6', '<p>{getMessage()}</p>', '', '', function(opts) {
'use strict';

var name = 'Riot';
undefined.message = 'Hello ' + name;
undefined.getMessage = function () {
    return undefined.message;
};
});

note the undefined's

ilanc commented

If I manually correct this and rerun from the console then it works i.e.

riot.tag2('es-6', '<p>{getMessage()}</p>', '', '', function(opts) {
'use strict';

var name = 'Riot';
this.message = 'Hello ' + name;
this.getMessage = function () {
    return this.message;
};
});
riot.mount('*')

you are right this example was made with an old babel version. We need to update it using the newest babel