Skip to content

Instantly share code, notes, and snippets.

@RhinoLance
Created February 14, 2018 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RhinoLance/6382a225282e9ae20d381114749fee2c to your computer and use it in GitHub Desktop.
Save RhinoLance/6382a225282e9ae20d381114749fee2c to your computer and use it in GitHub Desktop.
Ionic not displaying page until window resize
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import {Observable} from 'rxjs/Rx';
import { Subject } from "rxjs/Rx";
import { HomePage } from '../pages/home/home';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
let source = this.init();
source.subscribe(
result => {
this.rootPage = HomePage;
});
});
}
private init() : Observable<any> {
let db = window["openDatabase"]( "test", "1.0", "bobo_test", 50 * 1024 * 1024);
let observable = new Subject();
db.transaction( (transaction) => {
transaction.executeSql("SELECT count(*) FROM sqlite_master", [],
(tx, result ) => {
console.log( `db.query compelte: ${JSON.stringify(result)}`);
observable.next( result );
observable.complete();
},
(tx, error) => {
console.error( "db.query error: " + JSON.stringify(tx) + "\n" + error.message );
observable.error( error.message );
observable.complete();
}
);
});
return observable;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment