Switching between views in Ionic2 is too slow - performance

I'm building an Ionic application, I have built 50% of the project, and at first I used the sidemenu template that is auto generated with ionic start MyProject sidemenu, and then I added my own pages and components after that.
In the browser view the app was great, then I deployed my application to an android device, with the deployment being successfully When I start the application I felt that the application was slow, but when I switch to a some view, it took 5-10 seconds to open the new page.
I watched the traffic between the server side and the application, and observed that the application is not switching to the new page until the request is back and the view is rendered!
any help?

Try switching to your views first and then using the ionViewWillEnter() or another built in ionic API for the application lifecycle.
ionViewWillEnter will pull the data everytime the view loads, where
ionViewDidLoad will pull the page on first load only.
ionViewDidLoad() {
console.log('ionViewDidLoad SplashPage');
}

You do not state which version of ionic you are using but in ionic 3 if you create your pages with the terminal using
ionic g page MyPage
It will automatically create the page as a module. This allows for lazy loading. You can read more on it here form ionic's official blog post.
Its hard to say exactly why the view is only loading after it hits the server as you have not added your navigational code. There could be a code block that waits for a server response before pushing to the next page.
If your view is depended on received data from the server then your request should be in a new Promise allowing you to add conditionals for before and/or after the data has been touched.

Related

SpringBoot2 how can I load newly added resources when running

I'm working on a web program.
In a controller, I create a picture using JfreeChart and save in /resources/image/.
But I can't load it on the web page immediately yet I can see the file under the directory. About 10s later, it can be loaded.
I'm not sure if I need to refresh resources in my code, And how should I refresh if needed.

Blazor Hub Does not Connect Across Entire MVC App

I upgraded an ASP.NET Core 2.2 MVC project to 3.0 in order to use a Blazor component in one of the views of the application. After setting up Blazor in the MVC project and running it, the Blazor hub connects just fine as shown in the browser console screenshot below:
but when I navigate to the page that contains the blazor component or another page besides the index page for that matter, I get this:
As shown in the screenshot, it includes the name of the controller the url that negotiates for a websocket connection and throws a 404. If this is not a bug, how can I fix this to work on every view of the application or the view that contains my component to say the least?
What I needed to do was to set the app base path in shared.chtml and Boom! Problem Solved.

How to make web page load when scrolling in laravel project

I am doing a laravel project. i want to make web page content load when scrolling. i tried with several types. but not suceed.

Visual Studio 2013 Javascript Apache Cordova Project: How To

I just wonder how to do some events with Javascript Apache Cordova project on Visual Studio
Do i need to create new js file for each html file (like Controller - View on MVC)
What is the events fire sort ? (Which event first, which event next firing )
I do same sample, i put one button and when i click button i open new page, when i fire backbutton, first page comes, but button on the first page not working anymore, what is wrong ?
And at last, how can store some data on SQLite database localy and do some read,write,list actions ? Is there any sample code with these ?
Thanks everybody,
Do i need to create new js file for each html file (like Controller - View on MVC).
It's not necessary, you can put all code to one .js file. Depends on your coding style and used framework.
What is the events fire sort ? (Which event first, which event next firing ).
Cordova app, in fact, is a web page in mobile browser. So you should read proper docs. For special Cordova events see this page: http://cordova.apache.org/docs/en/4.0.0/cordova_events_events.md.html#Events
I do same sample, i put one button .....
First af all, it's recommended to use Single-Page-Application, for details see there: http://cordova.apache.org/docs/en/4.0.0/guide_next_index.md.html#Best%20Practices. As for your app, you shoukd provide some more details. Looks, like you missed some script or link while reloading first page.
how can store some data on SQLite database localy
First, read this page about storage: http://cordova.apache.org/docs/en/4.0.0/cordova_storage_storage.md.html#Storage. It's recommended to use WebSQL, but you can try this plugin: https://github.com/brodysoft/Cordova-SQLitePlugin, or read this article about WebSQL: http://msopentech.com/blog/2014/05/05/websql-plugin-for-apache-cordova/

How to reload a page on change in server database

I'm using tastypie + django + backbone.js . My application should be usable by more than one user at a time.
What I want to do is to show all users "live" changes on the database without having the users manually reloading the page.
Anyone around to point me in the right direction?
Thanks
To get this working in all major browsers you will have to periodically send an AJAX request to your server asking if any changes have occured.
In modern browsers you could make use ob web sockets to setup a PUSH service where the server can push those changes to your application or simply notify you about it.
(If you are using Backbone as an MVC framework anyway you might as well step back from the idea of reloading the page and just request your data using AJAX and use Backbone's View component to render your data into HTML elements)

Resources