mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-09 04:24:04 -04:00
Lint and fix failing tests
This commit is contained in:
parent
c9ce6776aa
commit
f785117e1d
8 changed files with 38 additions and 19 deletions
|
@ -276,7 +276,7 @@ const parseScratchObject = function (object, runtime, topLevel) {
|
|||
/**
|
||||
* Top-level handler. Parse provided JSON,
|
||||
* and process the top-level object (the stage object).
|
||||
* @param {!string} json SB2-format JSON to load.
|
||||
* @param {!object} json SB2-format JSON to load.
|
||||
* @param {!Runtime} runtime Runtime object to load all structures into.
|
||||
* @param {boolean=} optForceSprite If set, treat as sprite (Sprite2).
|
||||
* @return {?Promise} Promise that resolves to the loaded targets when ready.
|
||||
|
|
|
@ -16,7 +16,7 @@ const loadSound = require('../import/load-sound.js');
|
|||
/**
|
||||
* Serializes the specified VM runtime.
|
||||
* @param {!Runtime} runtime VM runtime instance to be serialized.
|
||||
* @return {string} Serialized runtime instance.
|
||||
* @return {object} Serialized runtime instance.
|
||||
*/
|
||||
const serialize = function (runtime) {
|
||||
// Fetch targets
|
||||
|
@ -150,11 +150,12 @@ const parseScratchObject = function (object, runtime) {
|
|||
/**
|
||||
* Deserializes the specified representation of a VM runtime and loads it into
|
||||
* the provided runtime instance.
|
||||
* @param {string} json Stringified JSON representation of a VM runtime.
|
||||
* @param {object} json JSON representation of a VM runtime.
|
||||
* @param {Runtime} runtime Runtime instance
|
||||
* @returns {Promise} Promise that resolves to the list of targets after the project is deserialized
|
||||
*/
|
||||
const deserialize = function (json, runtime) {
|
||||
return Promise.all(json.targets.map(target => parseScratchObject(target, runtime)));
|
||||
return Promise.all((json.targets || []).map(target => parseScratchObject(target, runtime)));
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue