Making methods explicitly private, public, or protected

This commit is contained in:
2025-06-21 19:49:58 -05:00
parent dae0cd9516
commit 5965bb7552
11 changed files with 81 additions and 61 deletions

View File

@@ -41,7 +41,7 @@ export class EditorsComponent {
}
public ngAfterViewInit(): void {
private ngAfterViewInit(): void {
this.loadSubscribers();
this.loadMainSubscribers();
@@ -54,12 +54,12 @@ export class EditorsComponent {
rightEditor.instance.leftSiblingUUID = leftEditor.instance.uuid;
}
ngOnDestroy() {
private ngOnDestroy() {
this.unsubscribe.next();
this.unsubscribe.complete();
}
loadSubscribers() {
private loadSubscribers() {
this.editorsService.getMessage$().pipe(
takeUntil(this.unsubscribe)
@@ -133,7 +133,7 @@ export class EditorsComponent {
}
loadMainSubscribers() {
private loadMainSubscribers() {
window.fs.onLoadFiles(async (paths: []) => {
for (let i = 0; i < paths.length; i++) {
let file = new File([], "") as NewtonFile;

View File

@@ -31,12 +31,12 @@ export class InfoBarComponent {
constructor() {}
public ngAfterViewInit(): void {
private ngAfterViewInit(): void {
this.loadSubscribers();
}
loadSubscribers() {
private loadSubscribers() {
this.infoBarService.updateInfoBarFPath$().pipe(
takeUntil(this.unsubscribe)

View File

@@ -38,11 +38,11 @@ export class FilesModalComponent {
}
public ngAfterViewInit(): void {
private ngAfterViewInit(): void {
this.loadSubscribers();
}
loadSubscribers() {
private loadSubscribers() {
this.tabsService.getMessage$().pipe(
takeUntil(this.unsubscribe)
).subscribe((data: ServiceMessage) => {
@@ -70,15 +70,15 @@ export class FilesModalComponent {
});
}
private createFileRow(title: string, uuid: string, path: string): void {
this.files.push({title: title, uuid: uuid, path: path})
}
createModal() {
private createModal() {
this.filesModal = new bootstrap.Modal("#filesModal", {});
}
showModal() {
public createFileRow(title: string, uuid: string, path: string): void {
this.files.push({title: title, uuid: uuid, path: path})
}
public showModal() {
this.filesModal?.toggle();
}

View File

@@ -35,7 +35,7 @@ export class NewtonEditorComponent extends NewtonEditorBase {
}
public ngAfterViewInit(): void {
private ngAfterViewInit(): void {
if (this.isDefault) {
this.addActiveStyling();
}
@@ -43,12 +43,17 @@ export class NewtonEditorComponent extends NewtonEditorBase {
this.loadAce();
}
public loadAce(): void {
private loadAce(): void {
ace.config.set('basePath', this.editorSettings.BASE_PATH);
this.editor = ace.edit( this.editorElm.nativeElement );
this.editor.setOptions( this.editorSettings.CONFIG );
this.loadAceKeyBindings();
this.loadAceEventBindings();
}
private loadAceKeyBindings(): void {
let keyBindings = [];
for (let i = 0; i < this.editorSettings.KEYBINDINGS.length; i++) {
let keyBinding = this.editorSettings.KEYBINDINGS[i];
@@ -78,6 +83,9 @@ export class NewtonEditorComponent extends NewtonEditorBase {
}
this.editor.commands.addCommands( keyBindings );
}
private loadAceEventBindings(): void {
// Note: https://ajaxorg.github.io/ace-api-docs/interfaces/ace.Ace.EditorEvents.html
this.editor.on("focus", (e) => {

View File

@@ -39,7 +39,16 @@ export class TabsComponent {
constructor() {
}
public ngAfterViewInit(): void {
private ngAfterViewInit(): void {
this.loadSubscribers();
}
private ngOnDestroy(): void {
this.unsubscribe.next();
this.unsubscribe.complete();
}
private loadSubscribers() {
this.tabsService.getMessage$().pipe(
takeUntil(this.unsubscribe)
).subscribe((message: ServiceMessage) => {
@@ -61,17 +70,7 @@ export class TabsComponent {
});
}
ngOnDestroy(): void {
this.unsubscribe.next();
this.unsubscribe.complete();
}
private createTab(title: string, uuid: string, path: string): void {
this.tabs.push({title: title, uuid: uuid, path: path});
this.changeDetectorRef.detectChanges();
}
handleAction(event: any): void {
protected handleAction(event: any): void {
let target = event.target;
if ( target.classList.contains("tab") ) {
@@ -93,7 +92,12 @@ export class TabsComponent {
}
closeTab(fpath: string): void {
public createTab(title: string, uuid: string, path: string): void {
this.tabs.push({title: title, uuid: uuid, path: path});
this.changeDetectorRef.detectChanges();
}
public closeTab(fpath: string): void {
this.sendEditorsServiceAMessage("close-tab", fpath);
for (let i = 0; i < this.tabs.length; i++) {
@@ -104,8 +108,7 @@ export class TabsComponent {
}
moved(event: any): void {
private moved(event: any): void {
let target = event.event.target;
let fpath = "";
@@ -125,7 +128,7 @@ export class TabsComponent {
}
dropped(event: CdkDragDrop<any>): void {
protected dropped(event: CdkDragDrop<any>): void {
if (this.newIndex == -1) return;
moveItemInArray(this.tabs, event.previousIndex, this.newIndex);