You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
ac.flush() might take a while to render, while ac.done() is pretty fast since there's no template processing.
Template processing has an asynchronous execution and might finish after the order of the execution.
ac.done() finish its execution before ac.flush(). This problem could be solved if ac.flush() had a callback so we could add sequencial commands (AKA callback pyramid of doom).
I believe the flow is the following:
-> ac.flush()
-> lib/app/addons/ac/output-adapter.common.js::flush() // wrapper
-> lib/app/addons/ac/output-adapter.common.js::done()
-> lib/app/autoload/view-renderer.common.js::render()
-> lib/app/addons/view-engines/mu.server.js::render() // asynchronous call, callback is adapter flush()
-> lib/output-handler.server.js:: flush() // this is the final adapter for flush(). There's no callback
here. There's also no callback for the done()
Maybe ac should emit an event when the output is finished (mu.server.js::done()), so that we know that we have already flushed all the data.
This example is a real case scenario where you want to flush first byte content to improve performance (load css / js before the page rendering is complete).
We are moving toward synchronous template resolution and rendering, in which case this is not going to be an issue in 0.6.x, I will like to keep this around until we get there.
Consider the following example:
ac.flush() might take a while to render, while ac.done() is pretty fast since there's no template processing.
Template processing has an asynchronous execution and might finish after the order of the execution.
ac.done() finish its execution before ac.flush(). This problem could be solved if ac.flush() had a callback so we could add sequencial commands (AKA callback pyramid of doom).
I believe the flow is the following:
-> ac.flush()
-> lib/app/addons/ac/output-adapter.common.js::flush() // wrapper
-> lib/app/addons/ac/output-adapter.common.js::done()
-> lib/app/autoload/view-renderer.common.js::render()
-> lib/app/addons/view-engines/mu.server.js::render() // asynchronous call, callback is adapter flush()
-> lib/output-handler.server.js:: flush() // this is the final adapter for flush(). There's no callback
here. There's also no callback for the done()
Maybe ac should emit an event when the output is finished (mu.server.js::done()), so that we know that we have already flushed all the data.
This example is a real case scenario where you want to flush first byte content to improve performance (load css / js before the page rendering is complete).
http://developer.yahoo.com/performance/rules.html#flush
The text was updated successfully, but these errors were encountered: