Answer the question
In order to leave comments, you need to log in
Is there a callback at the end of work in mustache?
I use the mustache template engine, there is a code:
var res = mustache.render(pages['main'], {
'country': 'Russia',
'city': 'Moscow',
...
});
console.log(res);
Answer the question
In order to leave comments, you need to log in
There it looks like stream is returning, so you need something like this:
var stream = mustache.render(pages['main'], {
'country': 'Russia',
'city': 'Moscow',
...
});
var rendered_data = '';
stream.on('data', function (data) {
rendered_data += data.toString();
});
stream.on('end', function () {
// Шаблон отрендерен
console.log(rendered_data);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question