A micro (~0.7Kb gzipped) javascript library to design precisely the resources loading pipeline. In plain terms, you can define the order to load assets based on your design choices.
Check out the effects on our website. Best viewed with low-band connection.
The browsers are very smart when dealing with assets loading. They usually handle and solve all the low-level stuff for you trying to load, asynchronously, all the resources as fast as possible.
The problem here is that the browsers are very optimistics about bandwidth and at the same time they totally ignore the page composition from the user point of view.
The result is that you cannot really make decisions about the little journey the user is expecting to follow during the first access to your website.
It should be a designer responsibility to define which are the resources the browser should load first because they are meaningful in the first phase of the user interaction.
Leaving these choices to the browser means that every session will be different according to the network and servers conditions on that particular moment in time.
With this little library the designer can precisely define the exact loading sequence, based on the user journey that has been designed. Plus you can exploit callback for each loaded
event to refine, in details, what should happen on screen based on the assets availability.
This is a minimal code snippet to show how to control the pipeline:
var pipe = new CriticalPath()
.load('imaes/1.jpg')
.src('#myImage1')
.end(function(){
console.log('do something')
})
.start()
Check the examples
folder for working files.
If you use Bower you can install with this line:
bower install CriticalPath
You can also download the .zip of this repo and include the library in your html file.
In progress...
In progress...
Copyright (c) 2015 abusedmedia
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- initial release