mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-25 05:31:44 -04:00
Remove cruft and fix for..in loops.
This commit is contained in:
parent
9d3a3fd12f
commit
ab863096cd
1 changed files with 2 additions and 4 deletions
|
@ -52,6 +52,7 @@ const serializeBlock = function (block) {
|
||||||
const serializeBlocks = function (blocks) {
|
const serializeBlocks = function (blocks) {
|
||||||
const obj = Object.create(null);
|
const obj = Object.create(null);
|
||||||
for (const blockID in blocks) {
|
for (const blockID in blocks) {
|
||||||
|
if (!blocks.hasOwnProperty(blockID)) continue;
|
||||||
obj[blockID] = serializeBlock(blocks[blockID]);
|
obj[blockID] = serializeBlock(blocks[blockID]);
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -88,9 +89,6 @@ const serializeSound = function (sound) {
|
||||||
// but that change should be made carefully since it is very
|
// but that change should be made carefully since it is very
|
||||||
// pervasive
|
// pervasive
|
||||||
obj.md5ext = sound.md5;
|
obj.md5ext = sound.md5;
|
||||||
// TODO do we need this soundID
|
|
||||||
// (not to be confused with soundId which is a uid for sounds)
|
|
||||||
// obj.soundID = sound.soundID;
|
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,7 +125,6 @@ const serialize = function (runtime) {
|
||||||
const flattenedOriginalTargets = JSON.parse(JSON.stringify(
|
const flattenedOriginalTargets = JSON.parse(JSON.stringify(
|
||||||
runtime.targets.filter(target => target.isOriginal)));
|
runtime.targets.filter(target => target.isOriginal)));
|
||||||
obj.targets = flattenedOriginalTargets.map(t => serializeTarget(t, runtime));
|
obj.targets = flattenedOriginalTargets.map(t => serializeTarget(t, runtime));
|
||||||
// runtime.targets.filter(target => target.isOriginal);
|
|
||||||
|
|
||||||
// TODO Serialize monitors
|
// TODO Serialize monitors
|
||||||
|
|
||||||
|
@ -171,6 +168,7 @@ const parseScratchObject = function (object, runtime, extensions, zip) {
|
||||||
}
|
}
|
||||||
if (object.hasOwnProperty('blocks')) {
|
if (object.hasOwnProperty('blocks')) {
|
||||||
for (const blockId in object.blocks) {
|
for (const blockId in object.blocks) {
|
||||||
|
if (!object.blocks.hasOwnProperty(blockId)) continue;
|
||||||
const blockJSON = object.blocks[blockId];
|
const blockJSON = object.blocks[blockId];
|
||||||
blocks.createBlock(blockJSON);
|
blocks.createBlock(blockJSON);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue