Last active
June 22, 2024 04:31
-
-
Save JenHsuan/3206b7dab1f750eb75c9d055b6be371a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, ViewChild } from '@angular/core'; | |
import { BehaviorSubject, Subject, delay, filter, switchMap, takeUntil, tap } from 'rxjs'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.scss'] | |
}) | |
export class AppComponent implements AfterViewInit{ | |
@ViewChild(TopologyComponent) commandReceiver: TopologyComponent; | |
@ViewChild(TopologyControlbarAssistantComponent) assistantCommandInvoker: TopologyControlbarAssistantComponent; | |
commandStack: TopologyCommand[] = []; | |
ngAfterViewInit() { | |
this.setCommandStack(this.assistantCommandInvoker, this.commandStack); | |
this.setMakeCommand(this.assistantCommandInvoker); | |
} | |
setCommandStack(invoker: TopologyCommandInvoker, commandStack: TopologyCommand[]) { | |
invoker.setCommandStack(commandStack); | |
} | |
setMakeCommand(invoker: TopologyCommandInvoker) { | |
invoker.setMakeCommand(this.makeCommand.bind(this)); | |
} | |
private makeCommand(statusType: TopologyStatusType): TopologyCommand { | |
return new TopologyCommand(this.commandReceiver, statusType); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment