mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -04:00
PERF: implemented OnInit on search page to speed up load
This commit is contained in:
parent
755aa28c3b
commit
632ee22189
@ -1,4 +1,4 @@
|
|||||||
import { Type, Component } from '@angular/core';
|
import { Type, Component, OnInit } from '@angular/core';
|
||||||
import { Loading, LoadingController, ModalController, NavParams, AlertController, MenuController } from 'ionic-angular';
|
import { Loading, LoadingController, ModalController, NavParams, AlertController, MenuController } from 'ionic-angular';
|
||||||
import { Storage } from '@ionic/storage';
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import { Reference } from '../../libs/Reference';
|
|||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'search.html'
|
templateUrl: 'search.html'
|
||||||
})
|
})
|
||||||
export class SearchPage
|
export class SearchPage implements OnInit
|
||||||
{
|
{
|
||||||
searchQuery = '';
|
searchQuery = '';
|
||||||
userProfile: UserProfile;
|
userProfile: UserProfile;
|
||||||
@ -30,7 +30,10 @@ export class SearchPage
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.userProfile = new UserProfile(UserProfile.createDefaultUser());
|
this.userProfile = new UserProfile(UserProfile.createDefaultUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void
|
||||||
|
{
|
||||||
// Check if there is a profile saved in local storage
|
// Check if there is a profile saved in local storage
|
||||||
this.local.get('profile').then(profile =>
|
this.local.get('profile').then(profile =>
|
||||||
{
|
{
|
||||||
@ -39,14 +42,14 @@ export class SearchPage
|
|||||||
if (profile !== null)
|
if (profile !== null)
|
||||||
t = JSON.parse(profile);
|
t = JSON.parse(profile);
|
||||||
|
|
||||||
this.userProfile.update(t, local);
|
this.userProfile.update(t, this.local);
|
||||||
|
|
||||||
this.initializeItems(this.userProfile);
|
this.initializeItems(this.userProfile);
|
||||||
}).catch(error =>
|
}).catch(error =>
|
||||||
{
|
{
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
actionsMenu()
|
actionsMenu()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user