Closed sapegin closed 5 years ago
It should work without if 1
<% @site.posts.limit(5).each (post) => : %>
<%- @someHelper post.title %>
<% end %>
It will run without errors, but not work. It works only for sync functions. You still can't query the cache or database (which seems to be the case in the original comment).
Yes, ect not support async calls, because it synchronous. For template engine purposes synchronous way gets more speed then asynchronous. But all data need to be prepared before we send it to template engine.
But still the idea to have a callbacks-based (or event better, promises-based) templates is so tempting that I subscribed for this issue just to see if someone comes up with a clever solution for it without hurting performance :)
It possibly can give some throughput improvements too, say while you querying the DB the rest of template which doesn't need it is being rendered.
The simplest way I could find is:
Is there anything better?