( displayURL: DisplayURL, readFile: ReadFile, semaphore: Semaphore, )
| 384 | } |
| 385 | |
| 386 | export async function getMediaDisplayURL( |
| 387 | displayURL: DisplayURL, |
| 388 | readFile: ReadFile, |
| 389 | semaphore: Semaphore, |
| 390 | ) { |
| 391 | const { path, id } = displayURL as DisplayURLObject; |
| 392 | return new Promise<string>((resolve, reject) => |
| 393 | semaphore.take(() => |
| 394 | getMediaAsBlob(path, id, readFile) |
| 395 | .then(blob => URL.createObjectURL(blob)) |
| 396 | .then(resolve, reject) |
| 397 | .finally(() => semaphore.leave()), |
| 398 | ), |
| 399 | ); |
| 400 | } |
| 401 | |
| 402 | export async function runWithLock(lock: AsyncLock, func: Function, message: string) { |
| 403 | try { |
no test coverage detected