@@ -10,7 +10,7 @@ import {initTargetPdfViewer} from '../render/pdf.ts';
1010import { initTargetButtons } from './common-button.ts' ;
1111import { initTargetCopyContent } from './copycontent.ts' ;
1212
13- async function toggleSidebar ( visibility , isSigned ) {
13+ async function toggleSidebar ( visibility : boolean , isSigned : boolean ) {
1414 const sidebarEl = document . querySelector ( '.repo-view-file-tree-sidebar' ) ;
1515 const showBtnEl = document . querySelector ( '.show-tree-sidebar-button' ) ;
1616 const containerClassList = sidebarEl . parentElement . classList ;
@@ -29,11 +29,11 @@ async function toggleSidebar(visibility, isSigned) {
2929 } ) ;
3030}
3131
32- async function loadChildren ( item , recursive ?: boolean ) {
32+ async function loadChildren ( path : string , recursive ?: boolean ) {
3333 const fileTree = document . querySelector ( '#view-file-tree' ) ;
3434 const apiBaseUrl = fileTree . getAttribute ( 'data-api-base-url' ) ;
3535 const refTypeNameSubURL = fileTree . getAttribute ( 'data-current-ref-type-name-sub-url' ) ;
36- const response = await GET ( `${ apiBaseUrl } /tree/${ refTypeNameSubURL } /${ item ? item . path : '' } ?recursive=${ recursive ?? false } ` ) ;
36+ const response = await GET ( `${ apiBaseUrl } /tree/${ refTypeNameSubURL } /${ path ?? '' } ?recursive=${ recursive ?? false } ` ) ;
3737 const json = await response . json ( ) ;
3838 if ( json instanceof Array ) {
3939 return json . map ( ( i ) => ( {
@@ -90,12 +90,12 @@ export async function initViewFileTreeSidebar() {
9090
9191 const selectedItem = ref ( treePath ) ;
9292
93- const files = await loadChildren ( { path : treePath } , true ) ;
93+ const files = await loadChildren ( treePath , true ) ;
9494
9595 fileTree . classList . remove ( 'is-loading' ) ;
96- const fileTreeView = createApp ( ViewFileTree , { files, selectedItem, loadChildren, loadContent : ( item ) => {
97- window . history . pushState ( null , null , `${ baseUrl } /src${ refString } /${ item . path } ` ) ;
98- selectedItem . value = item . path ;
96+ const fileTreeView = createApp ( ViewFileTree , { files, selectedItem, loadChildren, loadContent : ( path : string ) => {
97+ window . history . pushState ( null , null , `${ baseUrl } /src${ refString } /${ path } ` ) ;
98+ selectedItem . value = path ;
9999 loadContent ( ) ;
100100 } } ) ;
101101 fileTreeView . mount ( fileTree ) ;
@@ -106,7 +106,7 @@ export async function initViewFileTreeSidebar() {
106106 } ) ;
107107}
108108
109- function extractPath ( url ) {
109+ function extractPath ( url : string ) {
110110 // Create a URL object
111111 const urlObj = new URL ( url ) ;
112112
0 commit comments