mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 18:25:30 +00:00
Type getCursorFromFilename
This commit is contained in:
parent
b873e0df31
commit
4dfc19a527
2 changed files with 14 additions and 11 deletions
|
|
@ -51,16 +51,6 @@ const CURSORS = [
|
|||
*/
|
||||
];
|
||||
|
||||
async function getCursorFromFilename(zip, fileName) {
|
||||
const file = await SkinParserUtils.getFileFromZip(
|
||||
zip,
|
||||
fileName,
|
||||
"CUR",
|
||||
"base64"
|
||||
);
|
||||
return file && `data:image/x-win-bitmap;base64,${file.contents}`;
|
||||
}
|
||||
|
||||
async function genPlaylistStyle(zip) {
|
||||
const pledit = await SkinParserUtils.getFileFromZip(
|
||||
zip,
|
||||
|
|
@ -114,7 +104,10 @@ async function genImages(zip) {
|
|||
async function genCursors(zip) {
|
||||
const cursorObjs = await Promise.all(
|
||||
CURSORS.map(async cursorName => ({
|
||||
[cursorName]: await getCursorFromFilename(zip, cursorName),
|
||||
[cursorName]: await SkinParserUtils.getCursorFromFilename(
|
||||
zip,
|
||||
cursorName
|
||||
),
|
||||
}))
|
||||
);
|
||||
return shallowMerge(cursorObjs);
|
||||
|
|
|
|||
|
|
@ -106,3 +106,13 @@ export async function getSpriteUrisFromFilename(
|
|||
}
|
||||
return getSpriteUrisFromImg(img, SKIN_SPRITES[fileName]);
|
||||
}
|
||||
|
||||
export async function getCursorFromFilename(
|
||||
zip: JSZip,
|
||||
fileName: string
|
||||
): Promise<string | null> {
|
||||
const file = await getFileFromZip(zip, fileName, "CUR", "base64");
|
||||
return file == null
|
||||
? null
|
||||
: `data:image/x-win-bitmap;base64,${file.contents}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue