vazco / universe-modules

Use ES6 / ES2015 modules in Meteor with SystemJS
https://atmospherejs.com/universe/modules
MIT License
52 stars 7 forks source link

Blaze example app ? #6

Closed vjau closed 9 years ago

vjau commented 9 years ago

Hi, could you please create a demo app using blaze, or show us some code snippets of the key techniques to do it ? How are you supposed to export/import template helpers, i can't get this to work.

Thank you in advance

MacRusher commented 9 years ago

We're using it internally only with React but you're right, we should provide a Blaze example as well.

About helpers and events, you should be able to do (based on basic app you get with meteor create):

helpers.import.js:

export let helpers = {
    counter: function () {
        return Session.get('counter');
    }
};

export let events = {
    'click button': function () {
        // increment the counter when button is clicked
        Session.set('counter', Session.get('counter') + 1);
    }
};

someFile.js:

System.import('helpers').then(function (module) {
    Template.hello.helpers(module.helpers);
    Template.hello.events(module.events);
});

I just checked and everything is working as intended :)

Does this answer satisfy you?

vjau commented 9 years ago

That make sense, thank you :)

MacRusher commented 9 years ago

Ok, closing for now. I will keep in mind that Blaze examples should be in the new docs that are coming soon.