node-swig / swig-templates

Take a swig of the best template engine for JavaScript.
http://node-swig.github.io/swig-templates/
MIT License
209 stars 29 forks source link

Support for async function #46

Open devalexqt opened 6 years ago

devalexqt commented 6 years ago

Is it support async call for function from template? Something like this. https://stackoverflow.com/questions/47955502/node-js-swig-is-it-support-async-function

nylen commented 6 years ago

Hi @devalexqt (and anyone else who reads this issue), not really. You need to first calculate all of your data using async callbacks in Node.js code. Then once you have everything, pass it synchronously to the template. There is a good, much more detailed answer on the StackOverflow question now: https://stackoverflow.com/a/47959830/106302