Compare commits
5 Commits
f24bda4cfe
...
96a81cb5ec
Author | SHA1 | Date | |
---|---|---|---|
96a81cb5ec | |||
697af17462 | |||
f79938a76d | |||
2049fc8833 | |||
4c50f26050 |
@ -1,10 +1,20 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router, RouterEvent } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrls: ['./app.component.scss'],
|
styleUrls: ['./app.component.scss'],
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
|
||||||
|
export class AppComponent implements OnInit{
|
||||||
|
constructor(private router: Router){ }
|
||||||
|
|
||||||
|
ngOnInit(){
|
||||||
|
document.addEventListener('GoChangeRoute_Callback', (event:any) => {
|
||||||
|
this.router.navigate([event.detail])
|
||||||
|
console.log("here")
|
||||||
|
})
|
||||||
|
}
|
||||||
title = 'go-web';
|
title = 'go-web';
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,10 @@ import { MainModule } from './components/main/main.module';
|
|||||||
import { PlaygroundModule } from './components/playground/playground.module';
|
import { PlaygroundModule } from './components/playground/playground.module';
|
||||||
import { SandboxModule } from './components/sandbox/sandbox.module';
|
import { SandboxModule } from './components/sandbox/sandbox.module';
|
||||||
import { SignInModule } from './components/sign-in/sign-in.module';
|
import { SignInModule } from './components/sign-in/sign-in.module';
|
||||||
|
import { LoadingScreenComponent } from './components/loading-screen/loading-screen.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AppComponent],
|
declarations: [AppComponent, LoadingScreenComponent],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
<p>loading-screen works!</p>
|
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { LoadingScreenComponent } from './loading-screen.component';
|
||||||
|
|
||||||
|
describe('LoadingScreenComponent', () => {
|
||||||
|
let component: LoadingScreenComponent;
|
||||||
|
let fixture: ComponentFixture<LoadingScreenComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
declarations: [ LoadingScreenComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(LoadingScreenComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,14 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: './loading-screen.component.html',
|
||||||
|
styleUrls: ['./loading-screen.component.scss']
|
||||||
|
})
|
||||||
|
export class LoadingScreenComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
import { LoadingScreenComponent } from '../components/loading-screen/loading-screen.component';
|
||||||
import { MainRoutingModule } from '../components/main/routing.module';
|
import { MainRoutingModule } from '../components/main/routing.module';
|
||||||
import { PlaygroundComponent } from '../components/playground/playground.component';
|
import { PlaygroundComponent } from '../components/playground/playground.component';
|
||||||
import { SandboxComponent } from '../components/sandbox/sandbox.component';
|
import { SandboxComponent } from '../components/sandbox/sandbox.component';
|
||||||
@ -11,7 +12,7 @@ const routes: Routes = [
|
|||||||
component: PlaygroundComponent,
|
component: PlaygroundComponent,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '',
|
path: 'main',
|
||||||
loadChildren: () => MainRoutingModule,
|
loadChildren: () => MainRoutingModule,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -22,6 +23,10 @@ const routes: Routes = [
|
|||||||
path: 'sign-in',
|
path: 'sign-in',
|
||||||
component: SignInComponent,
|
component: SignInComponent,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: LoadingScreenComponent,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -9,13 +9,16 @@ export interface Go extends Window {
|
|||||||
|
|
||||||
export interface GoCallback extends Window {
|
export interface GoCallback extends Window {
|
||||||
SetVersion: (value: string) => void;
|
SetVersion: (value: string) => void;
|
||||||
|
GoChangeRoute: (value: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { GoGetGames, GoRunGame, GoGetSessions } = window as unknown as Go;
|
let { GoGetGames, GoRunGame, GoGetSessions } = window as unknown as Go;
|
||||||
let { SetVersion } = window as unknown as GoCallback;
|
let { SetVersion, GoChangeRoute } = window as unknown as GoCallback;
|
||||||
|
|
||||||
let w = window as unknown as GoCallback;
|
let w = window as unknown as GoCallback;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// var register = function <Type>(name: string): void {
|
// var register = function <Type>(name: string): void {
|
||||||
// const event = new CustomEvent<Type>(`${name}_Callback`, {
|
// const event = new CustomEvent<Type>(`${name}_Callback`, {
|
||||||
// detail: value
|
// detail: value
|
||||||
@ -25,11 +28,11 @@ let w = window as unknown as GoCallback;
|
|||||||
|
|
||||||
// w.SetVersion = register<string>('SetVersion')
|
// w.SetVersion = register<string>('SetVersion')
|
||||||
|
|
||||||
// (<GoCallback>(<unknown>window)).SetVersion = function <T>(value: T): void {
|
(<GoCallback>(<unknown>window)).GoChangeRoute = function <T>(value: T): void {
|
||||||
// const event = new CustomEvent<T>('GetVersion_Callback', {
|
const event = new CustomEvent<T>('GoChangeRoute_Callback', {
|
||||||
// detail: value,
|
detail: value,
|
||||||
// });
|
});
|
||||||
// document.dispatchEvent(event);
|
document.dispatchEvent(event);
|
||||||
// };
|
};
|
||||||
|
|
||||||
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame };
|
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame, GoChangeRoute };
|
||||||
|
Loading…
Reference in New Issue
Block a user