@novely/core 0.46.4 → 0.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.global.js +19 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2326,6 +2326,7 @@ var loadImageFormatsSupport = async () => {
|
|
|
2326
2326
|
loadImageFormatsSupport();
|
|
2327
2327
|
|
|
2328
2328
|
// src/asset.ts
|
|
2329
|
+
var generateRandomId = () => Math.random().toString(36);
|
|
2329
2330
|
var getType = memoize4(
|
|
2330
2331
|
(extensions) => {
|
|
2331
2332
|
if (extensions.every((extension) => HOWLER_SUPPORTED_FILE_FORMATS.has(extension))) {
|
|
@@ -2379,7 +2380,8 @@ var assetPrivate = memoize4(
|
|
|
2379
2380
|
},
|
|
2380
2381
|
get type() {
|
|
2381
2382
|
return type;
|
|
2382
|
-
}
|
|
2383
|
+
},
|
|
2384
|
+
id: generateRandomId()
|
|
2383
2385
|
};
|
|
2384
2386
|
},
|
|
2385
2387
|
{
|
|
@@ -2390,16 +2392,28 @@ var asset = (...variants) => {
|
|
|
2390
2392
|
return assetPrivate(variants);
|
|
2391
2393
|
};
|
|
2392
2394
|
asset.image = (source) => {
|
|
2393
|
-
|
|
2395
|
+
if (assetPrivate.cache.has(source)) {
|
|
2396
|
+
return assetPrivate.cache.get(source);
|
|
2397
|
+
}
|
|
2398
|
+
const asset2 = {
|
|
2394
2399
|
type: "image",
|
|
2395
|
-
source
|
|
2400
|
+
source,
|
|
2401
|
+
id: generateRandomId()
|
|
2396
2402
|
};
|
|
2403
|
+
assetPrivate.cache.set(source, asset2);
|
|
2404
|
+
return asset2;
|
|
2397
2405
|
};
|
|
2398
2406
|
asset.audio = (source) => {
|
|
2399
|
-
|
|
2407
|
+
if (assetPrivate.cache.has(source)) {
|
|
2408
|
+
return assetPrivate.cache.get(source);
|
|
2409
|
+
}
|
|
2410
|
+
const asset2 = {
|
|
2400
2411
|
type: "audio",
|
|
2401
|
-
source
|
|
2412
|
+
source,
|
|
2413
|
+
id: generateRandomId()
|
|
2402
2414
|
};
|
|
2415
|
+
assetPrivate.cache.set(source, asset2);
|
|
2416
|
+
return asset2;
|
|
2403
2417
|
};
|
|
2404
2418
|
export {
|
|
2405
2419
|
EN,
|