generated from uwu/neptune-template
-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ExtendedTrackItem - Improve/Fix MusicBrainz lookups to use track inst…
…ead of recording
- Loading branch information
Showing
22 changed files
with
331 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { cacheEnsure, cacheRej, cacheRes } from "../nativeBridge"; | ||
|
||
export class SharedNativeCache<K extends string | number | symbol, V> { | ||
constructor(public readonly name?: string) {} | ||
|
||
public async ensure(key: K, generator: () => Promise<V>): Promise<V> { | ||
const [exists, value] = await cacheEnsure<V>(key, this.name); | ||
if (exists) return value; | ||
try { | ||
const result = await generator(); | ||
cacheRes(key, result, this.name); | ||
return result; | ||
} catch (err) { | ||
cacheRej(key, err, this.name); | ||
throw err; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.