Add callback to 'end' event handler
See original GitHub issueCurrently, it’s not possible to perform asynchronous operations within the end
event and manipulate the resulting CSS based on these operations. This causes a lot of problems since node.js and its ecosystem is primarily asynchronous. To mitigate this problem, I propose that a callback should be added like we once had in versions prior to 0.40.0, e.g.:
stylus.on('end', function (css, callback) {
someAsynchronousOperation(function (err, result) {
if (err) callback(err);
callback(null, result);
});
});
In case of multiple listeners, it could move to the next listener after the callback has been triggered to not cause any issues with asynchronous writes to the CSS.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Defining behavior with event callbacks and listeners
You can do this by defining event-handling callback functions as part of the definition of the control or window. To respond to a...
Read more >EventTarget.addEventListener() - Web APIs | MDN
The event listener can be specified as either a callback function or an object whose handleEvent() method serves as the callback function. The ......
Read more >Add callback to .addEventListener - javascript - Stack Overflow
I looked at bind, but that seems to focus on controlling which "this" gets sent over to the event listener function. Any other...
Read more >bokeh.events — Bokeh 3.0.3 Documentation
Represent granular events that can be used to trigger callbacks. Bokeh documents and applications are capable of supporting various kinds of interactions.
Read more >Homework: Event Handling with Event Listeners
We call the method addEventListener() on our form object to create the event listener. Just like with event handler properties, we target the ......
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 Free
Top 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
Any update on this? it’s quite important to make PostCSS work with Stylus 😕
👍