dashron / bifocals Goto Github PK
View Code? Open in Web Editor NEWA node.js View library with support for asynchronous sub-views (aka partials), and interchangeable rendering systems.
Home Page: bifocalsjs.com
License: MIT License
A node.js View library with support for asynchronous sub-views (aka partials), and interchangeable rendering systems.
Home Page: bifocalsjs.com
License: MIT License
What if there was a special kind of view that you could render separately, and then if it finished it would be included in the served html page, and if not, then an ajax call would be made from the client's partially rendered version to fill in the rest of the content
This is a pretty specific use case, been running through my head because I have an app that does a lot of data processing, and I don't want the user waiting 30 seconds before the page fully loads (however when there's a cache hit the response is instant).
Feel free to close this issue, this was just this easiest way for me to run the idea past you. TBH it's probably pretty simple to write some routes that make this easy.
This should improve performance, be easier to support, allow express integration, and allow bifocals to use any existing templating functions written to be used in express
Investigate it's usability.
Idea:
Render templates immediately with placeholders for all the child views.
Root is written exactly as is, but does not call end until all children are complete.
Children are delayed, and written as script tags outside of the root template. These are then injected on the client side as soon as they are available.
it is left over from early implementation. I believe it is not used at the moment, would it be worth adding some events?
I see a great view system in Bifocals, supporting the sort of nesting (and so smartly!) that I see as necessary in any reasonably complex website, and a great web framework in Express.js, which is template/view-agnostic,
My question is, why can't the two play together? It seems that your handling of status codes and routing concerns puts you at odds with Express.
I read your comment on Hacker News about Express, and wonder why you feel it is necessary to bring these web server-like elements to bear on the view handling process? Is it critical to the async nature of the rendering in some way?
Just curious. This isn't criticism at all.
Thanks!
statusUnauthorized(template)
Work uses spaces, personally I use tabs, I think my editor was confused.
301: permanent redirect
303: redirect away from http post
307: retry identical request at the provided uri
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.