frontend: Add linting for ts code
This commit is contained in:
parent
ddb4bb3546
commit
16fa721048
18 changed files with 2299 additions and 469 deletions
13
internal/dis/component/server/assets/src/lib/discard.ts
Normal file
13
internal/dis/component/server/assets/src/lib/discard.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { Mutex, MutexInterface } from 'async-mutex'
|
||||
|
||||
const error = console.error.bind(console)
|
||||
|
||||
/** discard discards the result of a promise, or logs an error if it occurs */
|
||||
export function discard<T> (p: Promise<T>): void {
|
||||
p.then((): void => {}).catch(error)
|
||||
}
|
||||
|
||||
/** runs worker exclusively on m, and discards the resulting promise */
|
||||
export function runMutexExclusive<T> (m: Mutex, worker: MutexInterface.Worker<T>): void {
|
||||
discard(m.runExclusive(worker))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue