@novely/core 0.36.0-beta.0 → 0.36.0-beta.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.
@@ -1179,6 +1179,11 @@ var Novely = (() => {
1179
1179
  await Promise.allSettled(list);
1180
1180
  ASSETS_TO_PRELOAD.clear();
1181
1181
  };
1182
+ const assetsToPreloadAdd = (asset) => {
1183
+ if (!PRELOADED_ASSETS.has(asset)) {
1184
+ ASSETS_TO_PRELOAD.add(asset);
1185
+ }
1186
+ };
1182
1187
  const scriptBase = async (part) => {
1183
1188
  Object.assign(story, flattenStory(part));
1184
1189
  let loadingIsShown = false;
@@ -1209,27 +1214,27 @@ var Novely = (() => {
1209
1214
  const checkAndAddToPreloadingList = (action2, props) => {
1210
1215
  if (action2 === "showBackground") {
1211
1216
  if (isImageAsset(props[0])) {
1212
- ASSETS_TO_PRELOAD.add(props[0]);
1217
+ assetsToPreloadAdd(props[0]);
1213
1218
  }
1214
1219
  if (props[0] && typeof props[0] === "object") {
1215
1220
  for (const value of Object.values(props[0])) {
1216
1221
  if (!isImageAsset(value))
1217
1222
  continue;
1218
- ASSETS_TO_PRELOAD.add(value);
1223
+ assetsToPreloadAdd(value);
1219
1224
  }
1220
1225
  }
1221
1226
  }
1222
1227
  if (isAudioAction(action2) && isString(props[0])) {
1223
- ASSETS_TO_PRELOAD.add(props[0]);
1228
+ assetsToPreloadAdd(props[0]);
1224
1229
  }
1225
1230
  if (action2 === "showCharacter" && isString(props[0]) && isString(props[1])) {
1226
1231
  const images = characters[props[0]].emotions[props[1]];
1227
1232
  if (Array.isArray(images)) {
1228
1233
  for (const asset of images) {
1229
- ASSETS_TO_PRELOAD.add(asset);
1234
+ assetsToPreloadAdd(asset);
1230
1235
  }
1231
1236
  } else {
1232
- ASSETS_TO_PRELOAD.add(images);
1237
+ assetsToPreloadAdd(images);
1233
1238
  }
1234
1239
  }
1235
1240
  };