20 lines
714 B
TypeScript
20 lines
714 B
TypeScript
import {type Can_Upload_Detail, during_upload, I} from "./globals";
|
|
import {Upload} from "./class-upload";
|
|
import {DropContainer} from "./class-drop-container";
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
if( !document.getElementById( 'fileInput' ) ) // Check if exists.
|
|
|
|
// @ts-ignore
|
|
I.drop_container = new DropContainer( document.getElementById( 'file-container' ) as HTMLElement, document.getElementById( 'file-container-text' ) as HTMLElement );
|
|
|
|
// @ts-ignore
|
|
document.addEventListener( 'can_upload', (e: CustomEvent<Can_Upload_Detail> ) => {
|
|
|
|
const { file } = e.detail;
|
|
if( !during_upload ) // @ts-ignore
|
|
I.upload = new Upload( file );
|
|
|
|
});
|
|
}) |