mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add loadFile method
This commit is contained in:
parent
c883fe85d6
commit
3f238dfd4e
1 changed files with 18 additions and 0 deletions
|
|
@ -103,6 +103,24 @@ export class AppScan {
|
|||
)
|
||||
}
|
||||
|
||||
async loadFile () {
|
||||
// If fileLoader is no a function
|
||||
// then try to load the file
|
||||
if ( typeof( this.fileLoader ) !== 'function' ) {
|
||||
return this.fileLoader
|
||||
}
|
||||
|
||||
const file = this.fileLoader()
|
||||
|
||||
// Check if our file is a Promise
|
||||
// if it is then await it
|
||||
if ( file instanceof Promise || typeof file?.then === 'function' ) {
|
||||
return await file
|
||||
}
|
||||
|
||||
return file
|
||||
}
|
||||
|
||||
|
||||
async readFileBlob ( FileInstance ) {
|
||||
return new Promise( async ( resolve, reject ) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue