-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add lazy-loading support for files. Initialization takes too much time. #19
Comments
Not really, on my laptop it is as fast as enough |
@mayur-mi Are you taking about development version or dist version? Dist version loads comressed vendor and app scripts and should be fast enough. |
@lugovsky @ugurozturk ocLazyLoad actually pulls in files like css, views, JS-dependencies only when needed. We can save a lot of data transfer and bandwidth usage with that. I was just wondering why do we need to load all the stuff if we need only some to render a page and make it functional ? |
@mayur-mi I still don't quite understand are you talking about development or production mode? Just to clarify, when you run If you talking about production mode, I think correct way is to have all you javascripts loaded at once like we have it right now. In other case, when you navigate through app and click on some link on sidebar for example, you need be able to instantly load that page. In case you would not have some javascript files loaded at that moment, user will have bad experience, because he would need to wait for them to load. From user's perspective it means app works slowly. |
oc lazy load will load all the files .js, .css or images files on the fly(dynamically). using oclazyload.js file makes the user to modularization the application |
@lugovsky just for some data, i've got a 1-1.5mbps connection.
|
I guess this is NOT the way to do it, but when I lower the timeouts in Below another screenshot of the And these are the changes I made: function themeRun($timeout, $rootScope, layoutPaths, preloader, $q, baSidebarService, themeLayoutSettings) {
var whatToWait = [
preloader.loadAmCharts(),
$timeout(50)
];
var theme = themeLayoutSettings;
if (theme.blur) {
if (theme.mobile) {
whatToWait.unshift(preloader.loadImg(layoutPaths.images.root + 'blur-bg-mobile.jpg'));
} else {
whatToWait.unshift(preloader.loadImg(layoutPaths.images.root + 'blur-bg.jpg'));
whatToWait.unshift(preloader.loadImg(layoutPaths.images.root + 'blur-bg-blurred.jpg'));
}
}
$q.all(whatToWait).then(function () {
$rootScope.$pageFinishedLoading = true;
});
$timeout(function () {
if (!$rootScope.$pageFinishedLoading) {
$rootScope.$pageFinishedLoading = true;
}
}, 50);
$rootScope.$baSidebarService = baSidebarService;
} |
Thinking about it, if I understand the code correctly, loading the AmChart module has a default timeout of 3000 ms. This is quite similar to the idle times I'm experiencing. Could this lead in the right direction? |
@bremme just remove dependencies on bower.json & module.js that you don't need. i remove most dependencies like chart, etc. only keep what i deemed useful |
@vazh thanks! I figured it must be something like that, I'll have a look. |
@bremme becareful though, you need to modify few files to make it works. since this theme incorporate those module directive, etc inside /themes usually. you'll see the error when you run |
Hey @bremme The timeout of 3000ms was used only for demo purposes. You can remove it if you don't need it. The important thing is to keep AmChart preload promise, if you use amcharts. |
@lugovsky Thanks for your reply! So the timeout was put in there to show (demonstrate) the loading spinner and can/should be removed for production. I can image that other people don't need it. You could think about removing it or setting it to 500-1000 ms or perhaps make a note of it in de documentation. It took me a little while to figure this out, but maybe a more experiences angularJS/javascript developer would find it quicker. At least I learned something -> when your page has a large idle time -> look for timeouts:) |
Does anyone other than me not think that the app takes too long to load? We can reduce the load time by adding support for lazy-loading files. ocLazyLoad
The text was updated successfully, but these errors were encountered: