Async Extensions and Filter in NodeJS environment
See original GitHub issueDo async methods work in Nodejs? I cannot get them working with Extensions or Filters.
this.nunjucksEnv.addFilter('lookup', function(name, callback)
This gets no callback function passed to the anonymous function.
When trying an Extension the run method does get a callback function but if I do not call it immediately nunjucks just skips over it. If I add a console.log() to the async call in the run method, and in the nunjucks.render callback the log from the render callback ALWAYS fires first. I cannot figure out if this functionality just isn’t well tested. ’
Sorry, I cannot post code examples as they are fragments scattered throughout the framework (Sails.js)
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to use async functions with Array.filter in Javascript
Async filter with map. The async version is a bit more complicated this time and it works in two phases. The first one...
Read more >Node.js v19.3.0 Documentation
AsyncLocalStorage tracks async context; process.getActiveResourcesInfo() tracks active resources. The node:async_hooks module provides an API to track ...
Read more >Async.js
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use ...
Read more >How to use promises - Learn web development | MDN
Promises are the foundation of asynchronous programming in modern JavaScript. A promise is an object returned by an asynchronous function, ...
Read more >How to use Array.prototype.filter with async? - Stack Overflow
There is no way to use filter with an async function (at least that I know of). The simplest way that you have...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@etx It seems that you didnt’t
I’m not sure. Any fragments would be helpful.
Just tested it. Working now in the master branch. Thanks for the fix!!